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

use crate::*;

extern_class!(
    /// A representation of either a source or destination connection point in AVAudioEngine.
    ///
    /// AVAudioConnectionPoint describes either a source or destination connection point (node, bus)
    /// in AVAudioEngine's graph.
    ///
    /// Instances of this class are immutable.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfaudio/avaudioconnectionpoint?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVAudioConnectionPoint;
);

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

impl AVAudioConnectionPoint {
    extern_methods!(
        #[cfg(all(feature = "AVAudioNode", feature = "AVAudioTypes"))]
        /// Create a connection point object.
        ///
        /// Parameter `node`: the source or destination node
        ///
        /// Parameter `bus`: the output or input bus on the node
        ///
        /// If the node is nil, this method fails (returns nil).
        #[unsafe(method(initWithNode:bus:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithNode_bus(
            this: Allocated<Self>,
            node: &AVAudioNode,
            bus: AVAudioNodeBus,
        ) -> Retained<Self>;

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

        #[cfg(feature = "AVAudioNode")]
        /// Returns the node in the connection point.
        #[unsafe(method(node))]
        #[unsafe(method_family = none)]
        pub unsafe fn node(&self) -> Option<Retained<AVAudioNode>>;

        #[cfg(feature = "AVAudioTypes")]
        /// Returns the bus on the node in the connection point.
        #[unsafe(method(bus))]
        #[unsafe(method_family = none)]
        pub unsafe fn bus(&self) -> AVAudioNodeBus;
    );
}

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