use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
use objc2_foundation::*;
use crate::*;
extern "C" {
pub static GKPlayerIDNoLongerAvailable: &'static NSString;
}
extern_class!(
#[unsafe(super(GKBasePlayer, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "GKBasePlayer")]
pub struct GKPlayer;
);
#[cfg(feature = "GKBasePlayer")]
extern_conformance!(
unsafe impl NSCopying for GKPlayer {}
);
#[cfg(feature = "GKBasePlayer")]
unsafe impl CopyingHelper for GKPlayer {
type Result = Self;
}
#[cfg(feature = "GKBasePlayer")]
extern_conformance!(
unsafe impl NSObjectProtocol for GKPlayer {}
);
#[cfg(feature = "GKBasePlayer")]
impl GKPlayer {
extern_methods!(
#[unsafe(method(scopedIDsArePersistent))]
#[unsafe(method_family = none)]
pub unsafe fn scopedIDsArePersistent(&self) -> bool;
#[unsafe(method(gamePlayerID))]
#[unsafe(method_family = none)]
pub unsafe fn gamePlayerID(&self) -> Retained<NSString>;
#[unsafe(method(teamPlayerID))]
#[unsafe(method_family = none)]
pub unsafe fn teamPlayerID(&self) -> Retained<NSString>;
#[unsafe(method(displayName))]
#[unsafe(method_family = none)]
pub unsafe fn displayName(&self) -> Retained<NSString>;
#[unsafe(method(alias))]
#[unsafe(method_family = none)]
pub unsafe fn alias(&self) -> Retained<NSString>;
#[unsafe(method(anonymousGuestPlayerWithIdentifier:))]
#[unsafe(method_family = none)]
pub unsafe fn anonymousGuestPlayerWithIdentifier(
guest_identifier: &NSString,
) -> Retained<Self>;
#[unsafe(method(guestIdentifier))]
#[unsafe(method_family = none)]
pub unsafe fn guestIdentifier(&self) -> Option<Retained<NSString>>;
#[unsafe(method(isInvitable))]
#[unsafe(method_family = none)]
pub unsafe fn isInvitable(&self) -> bool;
);
}
#[cfg(feature = "GKBasePlayer")]
impl GKPlayer {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct GKPhotoSize(pub NSInteger);
impl GKPhotoSize {
#[doc(alias = "GKPhotoSizeSmall")]
pub const Small: Self = Self(0);
#[doc(alias = "GKPhotoSizeNormal")]
pub const Normal: Self = Self(1);
}
unsafe impl Encode for GKPhotoSize {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for GKPhotoSize {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(feature = "GKBasePlayer")]
impl GKPlayer {
extern_methods!(
#[cfg(all(feature = "block2", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
#[unsafe(method(loadPhotoForSize:withCompletionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn loadPhotoForSize_withCompletionHandler(
&self,
size: GKPhotoSize,
completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSImage, *mut NSError)>>,
);
);
}
extern "C" {
pub static GKPlayerDidChangeNotificationName: &'static NSNotificationName;
}
#[cfg(feature = "GKBasePlayer")]
impl GKPlayer {
extern_methods!(
#[deprecated]
#[unsafe(method(isFriend))]
#[unsafe(method_family = none)]
pub unsafe fn isFriend(&self) -> bool;
#[deprecated = "Use ``GKPlayer/gamePlayerID`` or ``GKPlayer/teamPlayerID`` instead."]
#[unsafe(method(playerID))]
#[unsafe(method_family = none)]
pub unsafe fn playerID(&self) -> Retained<NSString>;
#[cfg(feature = "block2")]
#[deprecated]
#[unsafe(method(loadPlayersForIdentifiers:withCompletionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn loadPlayersForIdentifiers_withCompletionHandler(
identifiers: &NSArray<NSString>,
completion_handler: Option<
&block2::DynBlock<dyn Fn(*mut NSArray<GKPlayer>, *mut NSError)>,
>,
);
);
}