use objc::{msg_send, sel, sel_impl};
use crate::{
foundation::{NSIndexSet, UInt},
object,
objective_c_runtime::{
macros::interface_impl,
traits::{FromId, PNSObject},
},
utils::to_optional,
};
use super::NLLanguage;
#[derive(Debug)]
#[repr(i64)]
pub enum NLModelType {
Classifier,
Sequence,
}
object! {
unsafe pub struct NLModelConfiguration;
}
#[interface_impl(NSObject)]
impl NLModelConfiguration {
#[property]
pub fn language(&self) -> Option<NLLanguage> {
unsafe { to_optional(msg_send![self.m_self(), language]) }
}
#[property]
pub fn revision(&self) -> UInt {
unsafe { msg_send![self.m_self(), revision] }
}
#[method]
pub fn supported_revisions_for_type(r#type: NLModelType) -> NSIndexSet {
unsafe {
NSIndexSet::from_id(msg_send![
Self::m_class(),
supportedRevisionsForType: r#type
])
}
}
#[method]
pub fn current_revision_for_type(r#type: NLModelType) -> UInt {
unsafe { msg_send![Self::m_class(), currentRevisionForType: r#type] }
}
#[property]
pub fn ml_type(&self) -> NLModelType {
unsafe { msg_send![self.m_self(), type] }
}
}