//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIPrinterJobTypes(pub NSInteger);
bitflags::bitflags! {
    impl UIPrinterJobTypes: NSInteger {
        const UIPrinterJobTypeUnknown = 0;
        const UIPrinterJobTypeDocument = 1<<0;
        const UIPrinterJobTypeEnvelope = 1<<1;
        const UIPrinterJobTypeLabel = 1<<2;
        const UIPrinterJobTypePhoto = 1<<3;
        const UIPrinterJobTypeReceipt = 1<<4;
        const UIPrinterJobTypeRoll = 1<<5;
        const UIPrinterJobTypeLargeFormat = 1<<6;
        const UIPrinterJobTypePostcard = 1<<7;
    }
}

unsafe impl Encode for UIPrinterJobTypes {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UIPrinterJobTypes {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIPrinter;

    unsafe impl ClassType for UIPrinter {
        type Super = NSObject;
        type Mutability = MainThreadOnly;
    }
);

unsafe impl NSObjectProtocol for UIPrinter {}

extern_methods!(
    unsafe impl UIPrinter {
        #[method_id(@__retain_semantics Other printerWithURL:)]
        pub unsafe fn printerWithURL(url: &NSURL, mtm: MainThreadMarker) -> Retained<UIPrinter>;

        #[method_id(@__retain_semantics Other URL)]
        pub unsafe fn URL(&self) -> Retained<NSURL>;

        #[method_id(@__retain_semantics Other displayName)]
        pub unsafe fn displayName(&self) -> Retained<NSString>;

        #[method_id(@__retain_semantics Other displayLocation)]
        pub unsafe fn displayLocation(&self) -> Option<Retained<NSString>>;

        #[method(supportedJobTypes)]
        pub unsafe fn supportedJobTypes(&self) -> UIPrinterJobTypes;

        #[method_id(@__retain_semantics Other makeAndModel)]
        pub unsafe fn makeAndModel(&self) -> Option<Retained<NSString>>;

        #[method(supportsColor)]
        pub unsafe fn supportsColor(&self) -> bool;

        #[method(supportsDuplex)]
        pub unsafe fn supportsDuplex(&self) -> bool;

        #[cfg(feature = "block2")]
        #[method(contactPrinter:)]
        pub unsafe fn contactPrinter(
            &self,
            completion_handler: Option<&block2::Block<dyn Fn(Bool)>>,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl UIPrinter {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);
