//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::AppKit::*;
use crate::Foundation::*;
use crate::WebKit::*;

ns_enum!(
    #[underlying(NSInteger)]
    pub enum WKDownloadRedirectPolicy {
        WKDownloadRedirectPolicyCancel = 0,
        WKDownloadRedirectPolicyAllow = 1,
    }
);

extern_protocol!(
    pub unsafe trait WKDownloadDelegate: NSObjectProtocol {
        #[cfg(all(
            feature = "Foundation_NSString",
            feature = "Foundation_NSURL",
            feature = "Foundation_NSURLResponse",
            feature = "WebKit_WKDownload"
        ))]
        #[method(download:decideDestinationUsingResponse:suggestedFilename:completionHandler:)]
        unsafe fn download_decideDestinationUsingResponse_suggestedFilename_completionHandler(
            &self,
            download: &WKDownload,
            response: &NSURLResponse,
            suggested_filename: &NSString,
            completion_handler: &Block<(*mut NSURL,), ()>,
        );

        #[cfg(all(
            feature = "Foundation_NSHTTPURLResponse",
            feature = "Foundation_NSURLRequest",
            feature = "WebKit_WKDownload"
        ))]
        #[optional]
        #[method(download:willPerformHTTPRedirection:newRequest:decisionHandler:)]
        unsafe fn download_willPerformHTTPRedirection_newRequest_decisionHandler(
            &self,
            download: &WKDownload,
            response: &NSHTTPURLResponse,
            request: &NSURLRequest,
            decision_handler: &Block<(WKDownloadRedirectPolicy,), ()>,
        );

        #[cfg(all(
            feature = "Foundation_NSURLAuthenticationChallenge",
            feature = "Foundation_NSURLCredential",
            feature = "WebKit_WKDownload"
        ))]
        #[optional]
        #[method(download:didReceiveAuthenticationChallenge:completionHandler:)]
        unsafe fn download_didReceiveAuthenticationChallenge_completionHandler(
            &self,
            download: &WKDownload,
            challenge: &NSURLAuthenticationChallenge,
            completion_handler: &Block<
                (NSURLSessionAuthChallengeDisposition, *mut NSURLCredential),
                (),
            >,
        );

        #[cfg(feature = "WebKit_WKDownload")]
        #[optional]
        #[method(downloadDidFinish:)]
        unsafe fn downloadDidFinish(&self, download: &WKDownload);

        #[cfg(all(
            feature = "Foundation_NSData",
            feature = "Foundation_NSError",
            feature = "WebKit_WKDownload"
        ))]
        #[optional]
        #[method(download:didFailWithError:resumeData:)]
        unsafe fn download_didFailWithError_resumeData(
            &self,
            download: &WKDownload,
            error: &NSError,
            resume_data: Option<&NSData>,
        );
    }

    unsafe impl ProtocolType for dyn WKDownloadDelegate {}
);
