objc2-tv-services 0.3.2

Bindings to the TVServices framework
Documentation
//! 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 objc2_foundation::*;

use crate::*;

/// Options for describing media capabilities supported by a movie or show.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/tvservices/tvtopshelfcarouselitemmediaoptions?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct TVTopShelfCarouselItemMediaOptions(pub NSUInteger);
bitflags::bitflags! {
    impl TVTopShelfCarouselItemMediaOptions: NSUInteger {
/// High-definition video resolution.
///
/// Only one resolution value should be provided.
        #[doc(alias = "TVTopShelfCarouselItemVideoResolutionHD")]
        const VideoResolutionHD = 1<<0;
/// Ultra-high-definition 4K video resolution.
///
/// Only one resolution value should be provided.
        #[doc(alias = "TVTopShelfCarouselItemVideoResolution4K")]
        const VideoResolution4K = 2<<0;
/// High-dynamic-range video.
///
/// Only one color space value should be provided.
        #[doc(alias = "TVTopShelfCarouselItemVideoColorSpaceHDR")]
        const VideoColorSpaceHDR = 1<<6;
/// Dolby Vision video.
///
/// Only one color space value should be provided.
        #[doc(alias = "TVTopShelfCarouselItemVideoColorSpaceDolbyVision")]
        const VideoColorSpaceDolbyVision = 2<<6;
/// Whether the movie or show supports Dolby Atmos audio.
        #[doc(alias = "TVTopShelfCarouselItemAudioDolbyAtmos")]
        const AudioDolbyAtmos = 1<<12;
/// Whether the movie or show supports closed captioning.
        #[doc(alias = "TVTopShelfCarouselItemAudioTranscriptionClosedCaptioning")]
        const AudioTranscriptionClosedCaptioning = 1<<13;
/// Whether the movie or show supports subtitles for the deaf and hard-of-hearing.
        #[doc(alias = "TVTopShelfCarouselItemAudioTranscriptionSDH")]
        const AudioTranscriptionSDH = 1<<14;
/// Whether the movie or show supports audio descriptions.
        #[doc(alias = "TVTopShelfCarouselItemAudioDescription")]
        const AudioDescription = 1<<15;
    }
}

unsafe impl Encode for TVTopShelfCarouselItemMediaOptions {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

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

extern_class!(
    /// An object that represents a single item in the carousel content style.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/tvservices/tvtopshelfcarouselitem?language=objc)
    #[unsafe(super(TVTopShelfItem, TVTopShelfObject, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
    pub struct TVTopShelfCarouselItem;
);

#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for TVTopShelfCarouselItem {}
);

#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
impl TVTopShelfCarouselItem {
    extern_methods!(
        /// A localized string that describes why this item is being shown in the Top Shelf.
        #[unsafe(method(contextTitle))]
        #[unsafe(method_family = none)]
        pub unsafe fn contextTitle(&self) -> Option<Retained<NSString>>;

        /// Setter for [`contextTitle`][Self::contextTitle].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setContextTitle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setContextTitle(&self, context_title: Option<&NSString>);

        /// A descriptive summary of the movie or show.
        #[unsafe(method(summary))]
        #[unsafe(method_family = none)]
        pub unsafe fn summary(&self) -> Option<Retained<NSString>>;

        /// Setter for [`summary`][Self::summary].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setSummary:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSummary(&self, summary: Option<&NSString>);

        /// The genre of the movie or show.
        #[unsafe(method(genre))]
        #[unsafe(method_family = none)]
        pub unsafe fn genre(&self) -> Option<Retained<NSString>>;

        /// Setter for [`genre`][Self::genre].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setGenre:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setGenre(&self, genre: Option<&NSString>);

        /// The length of the movie or show.
        #[unsafe(method(duration))]
        #[unsafe(method_family = none)]
        pub unsafe fn duration(&self) -> NSTimeInterval;

        /// Setter for [`duration`][Self::duration].
        #[unsafe(method(setDuration:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDuration(&self, duration: NSTimeInterval);

        /// The date this item was created or released.
        #[unsafe(method(creationDate))]
        #[unsafe(method_family = none)]
        pub unsafe fn creationDate(&self) -> Option<Retained<NSDate>>;

        /// Setter for [`creationDate`][Self::creationDate].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setCreationDate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCreationDate(&self, creation_date: Option<&NSDate>);

        /// The media options supported by the movie or show.
        ///
        /// Values provided here are used to show media capability badges in the Top Shelf UI.
        #[unsafe(method(mediaOptions))]
        #[unsafe(method_family = none)]
        pub unsafe fn mediaOptions(&self) -> TVTopShelfCarouselItemMediaOptions;

        /// Setter for [`mediaOptions`][Self::mediaOptions].
        #[unsafe(method(setMediaOptions:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMediaOptions(&self, media_options: TVTopShelfCarouselItemMediaOptions);

        /// The trailer for the movie or show.
        ///
        /// If provided this video is played after the image or cinemagraph when the user rests on the item.
        #[unsafe(method(previewVideoURL))]
        #[unsafe(method_family = none)]
        pub unsafe fn previewVideoURL(&self) -> Option<Retained<NSURL>>;

        /// Setter for [`previewVideoURL`][Self::previewVideoURL].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setPreviewVideoURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPreviewVideoURL(&self, preview_video_url: Option<&NSURL>);

        /// A looping video shown before the preview video instead of the image.
        ///
        /// If provided this video takes the place of the image. It will loop without sound until the preview video is ready to play.
        #[unsafe(method(cinemagraphURL))]
        #[unsafe(method_family = none)]
        pub unsafe fn cinemagraphURL(&self) -> Option<Retained<NSURL>>;

        /// Setter for [`cinemagraphURL`][Self::cinemagraphURL].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setCinemagraphURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCinemagraphURL(&self, cinemagraph_url: Option<&NSURL>);

        #[cfg(feature = "TVTopShelfNamedAttribute")]
        /// A collection of up to 4 named attributes displayed by the Top Shelf UI in a stylized manner.
        #[unsafe(method(namedAttributes))]
        #[unsafe(method_family = none)]
        pub unsafe fn namedAttributes(&self) -> Retained<NSArray<TVTopShelfNamedAttribute>>;

        #[cfg(feature = "TVTopShelfNamedAttribute")]
        /// Setter for [`namedAttributes`][Self::namedAttributes].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setNamedAttributes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setNamedAttributes(
            &self,
            named_attributes: &NSArray<TVTopShelfNamedAttribute>,
        );
    );
}

/// Methods declared on superclass `TVTopShelfItem`.
#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
impl TVTopShelfCarouselItem {
    extern_methods!(
        /// Create an item with a unique identifier.
        ///
        /// This identifier must be unique in the set of items you return to the system.
        #[unsafe(method(initWithIdentifier:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIdentifier(
            this: Allocated<Self>,
            identifier: &NSString,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `TVTopShelfObject`.
#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
impl TVTopShelfCarouselItem {
    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>;
    );
}