objc2-car-play 0.3.2

Bindings to the CarPlay 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::*;
#[cfg(feature = "objc2-map-kit")]
use objc2_map_kit::*;

use crate::*;

extern_class!(
    /// `CPRouteChoice`describes a possible route for a
    /// `CPTrip.`
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cproutechoice?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CPRouteChoice;
);

extern_conformance!(
    unsafe impl NSCoding for CPRouteChoice {}
);

extern_conformance!(
    unsafe impl NSCopying for CPRouteChoice {}
);

unsafe impl CopyingHelper for CPRouteChoice {
    type Result = Self;
}

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

extern_conformance!(
    unsafe impl NSSecureCoding for CPRouteChoice {}
);

impl CPRouteChoice {
    extern_methods!(
        /// Initialize a
        /// `CPRouteChoice`with summary variants, additional information variants, and selection summary variants.
        /// The variant strings should be provided as localized, displayable content.
        #[unsafe(method(initWithSummaryVariants:additionalInformationVariants:selectionSummaryVariants:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithSummaryVariants_additionalInformationVariants_selectionSummaryVariants(
            this: Allocated<Self>,
            summary_variants: &NSArray<NSString>,
            additional_information_variants: &NSArray<NSString>,
            selection_summary_variants: &NSArray<NSString>,
        ) -> Retained<Self>;

        #[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>;

        /// summaryVariants is an array of summary variants for this route choice, arranged from most to least preferred. You must provide at least one variant.
        /// The system will select the first variant that fits the available space. The variant strings should be provided as localized, displayable content.
        /// Example: "Via I-280 S"
        #[unsafe(method(summaryVariants))]
        #[unsafe(method_family = none)]
        pub unsafe fn summaryVariants(&self) -> Retained<NSArray<NSString>>;

        /// selectionSummaryVariants is an array of summary variants for this route choice, arranged from most to least preferred. You must provide at least one variant.
        /// The system will select the first variant that fits the available space.
        #[unsafe(method(selectionSummaryVariants))]
        #[unsafe(method_family = none)]
        pub unsafe fn selectionSummaryVariants(&self) -> Option<Retained<NSArray<NSString>>>;

        /// additionalInformationVariants is an array of additional information variants for this route choice, arranged from most to least preferred. You must provide at least one variant.
        /// The system will select the first variant that fits the available space. The variant strings should be provided as localized, displayable content.
        /// Examples: "Fastest Route", "Avoids Tolls"
        #[unsafe(method(additionalInformationVariants))]
        #[unsafe(method_family = none)]
        pub unsafe fn additionalInformationVariants(&self) -> Option<Retained<NSArray<NSString>>>;

        /// Any custom user info related to this route choice.
        #[unsafe(method(userInfo))]
        #[unsafe(method_family = none)]
        pub unsafe fn userInfo(&self) -> Option<Retained<AnyObject>>;

        /// Setter for [`userInfo`][Self::userInfo].
        ///
        /// # Safety
        ///
        /// `user_info` should be of the correct type.
        #[unsafe(method(setUserInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUserInfo(&self, user_info: Option<&AnyObject>);
    );
}

extern_class!(
    /// `CPTrip`represents an origin and destination with route choices.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cptrip?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CPTrip;
);

extern_conformance!(
    unsafe impl NSCoding for CPTrip {}
);

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

extern_conformance!(
    unsafe impl NSSecureCoding for CPTrip {}
);

impl CPTrip {
    extern_methods!(
        #[cfg(feature = "objc2-map-kit")]
        /// Initialize a
        /// `CPTrip`with an origin item, destination item, and route choices.
        #[unsafe(method(initWithOrigin:destination:routeChoices:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithOrigin_destination_routeChoices(
            this: Allocated<Self>,
            origin: &MKMapItem,
            destination: &MKMapItem,
            route_choices: &NSArray<CPRouteChoice>,
        ) -> Retained<Self>;

        #[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>;

        #[cfg(feature = "objc2-map-kit")]
        /// `MKMapItem`representing the origin for the trip.
        #[unsafe(method(origin))]
        #[unsafe(method_family = none)]
        pub unsafe fn origin(&self) -> Retained<MKMapItem>;

        #[cfg(feature = "objc2-map-kit")]
        /// `MKMapItem`representing the destination for the trip.
        #[unsafe(method(destination))]
        #[unsafe(method_family = none)]
        pub unsafe fn destination(&self) -> Retained<MKMapItem>;

        /// Array of
        /// `CPRouteChoices`for the trip.
        #[unsafe(method(routeChoices))]
        #[unsafe(method_family = none)]
        pub unsafe fn routeChoices(&self) -> Retained<NSArray<CPRouteChoice>>;

        /// Any custom user info related to this trip.
        #[unsafe(method(userInfo))]
        #[unsafe(method_family = none)]
        pub unsafe fn userInfo(&self) -> Option<Retained<AnyObject>>;

        /// Setter for [`userInfo`][Self::userInfo].
        ///
        /// # Safety
        ///
        /// `user_info` should be of the correct type.
        #[unsafe(method(setUserInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUserInfo(&self, user_info: Option<&AnyObject>);

        /// destinationNameVariants is an array of
        /// `NSString`representing the name of the destination for
        /// this trip, arranged from most to least preferred. You must provide at least one variant.
        /// The variant strings should be provided as localized, displayable content.
        #[unsafe(method(destinationNameVariants))]
        #[unsafe(method_family = none)]
        pub unsafe fn destinationNameVariants(&self) -> Option<Retained<NSArray<NSString>>>;

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