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

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsdistributedlock?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSDistributedLock;
);

unsafe impl Send for NSDistributedLock {}

unsafe impl Sync for NSDistributedLock {}

extern_conformance!(
    unsafe impl NSObjectProtocol for NSDistributedLock {}
);

impl NSDistributedLock {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[unsafe(method(lockWithPath:))]
        #[unsafe(method_family = none)]
        pub fn lockWithPath(path: &NSString) -> Option<Retained<NSDistributedLock>>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(initWithPath:))]
        #[unsafe(method_family = init)]
        pub fn initWithPath(this: Allocated<Self>, path: &NSString) -> Option<Retained<Self>>;

        #[unsafe(method(tryLock))]
        #[unsafe(method_family = none)]
        pub fn tryLock(&self) -> bool;

        #[unsafe(method(unlock))]
        #[unsafe(method_family = none)]
        pub fn unlock(&self);

        #[unsafe(method(breakLock))]
        #[unsafe(method_family = none)]
        pub fn breakLock(&self);

        #[cfg(feature = "NSDate")]
        #[unsafe(method(lockDate))]
        #[unsafe(method_family = none)]
        pub fn lockDate(&self) -> Retained<NSDate>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSDistributedLock {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}
