// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::SettingsSchemaKey;
use glib::translate::*;

glib::wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct SettingsSchema(Shared<ffi::GSettingsSchema>);

    match fn {
        ref => |ptr| ffi::g_settings_schema_ref(ptr),
        unref => |ptr| ffi::g_settings_schema_unref(ptr),
        type_ => || ffi::g_settings_schema_get_type(),
    }
}

impl SettingsSchema {
    #[doc(alias = "g_settings_schema_get_id")]
    #[doc(alias = "get_id")]
    pub fn id(&self) -> glib::GString {
        unsafe { from_glib_none(ffi::g_settings_schema_get_id(self.to_glib_none().0)) }
    }

    #[doc(alias = "g_settings_schema_get_key")]
    #[doc(alias = "get_key")]
    pub fn key(&self, name: &str) -> SettingsSchemaKey {
        unsafe {
            from_glib_full(ffi::g_settings_schema_get_key(
                self.to_glib_none().0,
                name.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "g_settings_schema_get_path")]
    #[doc(alias = "get_path")]
    pub fn path(&self) -> Option<glib::GString> {
        unsafe { from_glib_none(ffi::g_settings_schema_get_path(self.to_glib_none().0)) }
    }

    #[doc(alias = "g_settings_schema_has_key")]
    pub fn has_key(&self, name: &str) -> bool {
        unsafe {
            from_glib(ffi::g_settings_schema_has_key(
                self.to_glib_none().0,
                name.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "g_settings_schema_list_children")]
    pub fn list_children(&self) -> Vec<glib::GString> {
        unsafe {
            FromGlibPtrContainer::from_glib_full(ffi::g_settings_schema_list_children(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "g_settings_schema_list_keys")]
    pub fn list_keys(&self) -> Vec<glib::GString> {
        unsafe {
            FromGlibPtrContainer::from_glib_full(ffi::g_settings_schema_list_keys(
                self.to_glib_none().0,
            ))
        }
    }
}
