use crate::ffi;
use glib::{GString, translate::*};

/// Network access method details.
pub struct MobileWizardAccessMethod(*mut ffi::NMAMobileWizardAccessMethod);

impl FromGlibPtrBorrow<*mut ffi::NMAMobileWizardAccessMethod> for MobileWizardAccessMethod {
    unsafe fn from_glib_borrow(_ptr: *mut ffi::NMAMobileWizardAccessMethod) -> Borrowed<Self> {
        Borrowed::new(MobileWizardAccessMethod(_ptr))
    }
}

impl MobileWizardAccessMethod {
    pub fn provider_name(&self) -> GString {
        unsafe { from_glib_none(self.0.read().provider_name) }
    }

    pub fn plan_name(&self) -> GString {
        unsafe { from_glib_none(self.0.read().plan_name) }
    }
    pub fn device_type(&self) -> nm::DeviceCapabilities {
        unsafe { from_glib(self.0.read().devtype) }
    }

    pub fn username(&self) -> GString {
        unsafe { from_glib_none(self.0.read().username) }
    }

    pub fn password(&self) -> GString {
        unsafe { from_glib_none(self.0.read().password) }
    }
    pub fn gsm_apn(&self) -> GString {
        unsafe { from_glib_none(self.0.read().gsm_apn) }
    }
}
