// GENERATED — DO NOT EDIT

///|
/// [Upstream documentation](https://docs.gtk.org/gio/class.MountOperation.html).
pub type MountOperation

///|
pub(open) trait IMountOperation {
  fn as_mount_operation(Self) -> MountOperation
  fn get_anonymous(Self) -> Bool = _
  fn get_choice(Self) -> Int = _
  fn get_domain(Self) -> String? = _
  fn get_is_tcrypt_hidden_volume(Self) -> Bool = _
  fn get_is_tcrypt_system_volume(Self) -> Bool = _
  fn get_password(Self) -> String? = _
  fn get_password_save(Self) -> PasswordSave = _
  fn get_pim(Self) -> UInt = _
  fn get_username(Self) -> String? = _
  fn reply(Self, MountOperationResult) -> Unit = _
  fn set_anonymous(Self, Bool) -> Unit = _
  fn set_choice(Self, Int) -> Unit = _
  fn set_domain(Self, String?) -> Unit = _
  fn set_is_tcrypt_hidden_volume(Self, Bool) -> Unit = _
  fn set_is_tcrypt_system_volume(Self, Bool) -> Unit = _
  fn set_password(Self, String?) -> Unit = _
  fn set_password_save(Self, PasswordSave) -> Unit = _
  fn set_pim(Self, UInt) -> Unit = _
  fn set_username(Self, String?) -> Unit = _
  fn connect_aborted(Self, (MountOperation) -> Unit) -> UInt64 = _
  fn connect_ask_password(
    Self,
    (MountOperation, String, String, String, AskPasswordFlags) -> Unit,
  ) -> UInt64 = _
  fn connect_reply(Self, (MountOperation, MountOperationResult) -> Unit) -> UInt64 = _
  fn connect_show_unmount_progress(
    Self,
    (MountOperation, String, Int64, Int64) -> Unit,
  ) -> UInt64 = _
}

///|
pub impl IMountOperation for MountOperation with fn as_mount_operation(self) {
  self
}

///|
/// Implementation contract for MountOperation.aborted. Self is the retained MoonBit state; the second parameter is the invoked MountOperation object.
pub(open) trait VMountOperationAborted {
  fn aborted(Self, MountOperation) -> Unit
}

///|
/// Implementation contract for MountOperation.ask_password. Self is the retained MoonBit state; the second parameter is the invoked MountOperation object.
pub(open) trait VMountOperationAskPassword {
  fn ask_password(
    Self,
    MountOperation,
    String,
    String,
    String,
    AskPasswordFlags,
  ) -> Unit
}

///|
/// Implementation contract for MountOperation.ask_question. Self is the retained MoonBit state; the second parameter is the invoked MountOperation object.
pub(open) trait VMountOperationAskQuestion {
  fn ask_question(Self, MountOperation, String, Array[String]) -> Unit
}

///|
/// Implementation contract for MountOperation.reply. Self is the retained MoonBit state; the second parameter is the invoked MountOperation object.
pub(open) trait VMountOperationReply {
  fn reply(Self, MountOperation, MountOperationResult) -> Unit
}

///|
/// Implementation contract for MountOperation.show_unmount_progress. Self is the retained MoonBit state; the second parameter is the invoked MountOperation object.
pub(open) trait VMountOperationShowUnmountProgress {
  fn show_unmount_progress(Self, MountOperation, String, Int64, Int64) -> Unit
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/ctor.MountOperation.new.html).
pub extern "c" fn MountOperation::new() -> MountOperation = "moonbit_g_mount_operation_new"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.get_anonymous.html).
#borrow(self)
pub extern "c" fn MountOperation::get_anonymous(self : MountOperation) -> Bool = "moonbit_g_mount_operation_get_anonymous"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.get_choice.html).
#borrow(self)
pub extern "c" fn MountOperation::get_choice(self : MountOperation) -> Int = "moonbit_g_mount_operation_get_choice"

///|
#borrow(self_)
extern "c" fn moonbit_g_mount_operation_get_domain(
  self_ : MountOperation,
) -> @glib.Nullable[Bytes] = "moonbit_g_mount_operation_get_domain"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.get_domain.html).
pub fn MountOperation::get_domain(self : MountOperation) -> String? {
  let result = moonbit_g_mount_operation_get_domain(self)
  match result.to_option() {
    Some(bytes) => Some(@encoding/utf8.decode_lossy(bytes))
    None => None
  }
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.get_is_tcrypt_hidden_volume.html).
#borrow(self)
pub extern "c" fn MountOperation::get_is_tcrypt_hidden_volume(
  self : MountOperation,
) -> Bool = "moonbit_g_mount_operation_get_is_tcrypt_hidden_volume"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.get_is_tcrypt_system_volume.html).
#borrow(self)
pub extern "c" fn MountOperation::get_is_tcrypt_system_volume(
  self : MountOperation,
) -> Bool = "moonbit_g_mount_operation_get_is_tcrypt_system_volume"

///|
#borrow(self_)
extern "c" fn moonbit_g_mount_operation_get_password(
  self_ : MountOperation,
) -> @glib.Nullable[Bytes] = "moonbit_g_mount_operation_get_password"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.get_password.html).
pub fn MountOperation::get_password(self : MountOperation) -> String? {
  let result = moonbit_g_mount_operation_get_password(self)
  match result.to_option() {
    Some(bytes) => Some(@encoding/utf8.decode_lossy(bytes))
    None => None
  }
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.get_password_save.html).
#borrow(self)
pub extern "c" fn MountOperation::get_password_save(
  self : MountOperation,
) -> PasswordSave = "moonbit_g_mount_operation_get_password_save"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.get_pim.html).
#borrow(self)
pub extern "c" fn MountOperation::get_pim(self : MountOperation) -> UInt = "moonbit_g_mount_operation_get_pim"

///|
#borrow(self_)
extern "c" fn moonbit_g_mount_operation_get_username(
  self_ : MountOperation,
) -> @glib.Nullable[Bytes] = "moonbit_g_mount_operation_get_username"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.get_username.html).
pub fn MountOperation::get_username(self : MountOperation) -> String? {
  let result = moonbit_g_mount_operation_get_username(self)
  match result.to_option() {
    Some(bytes) => Some(@encoding/utf8.decode_lossy(bytes))
    None => None
  }
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.reply.html).
#borrow(self)
pub extern "c" fn MountOperation::reply(
  self : MountOperation,
  result : MountOperationResult,
) = "moonbit_g_mount_operation_reply"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.set_anonymous.html).
#borrow(self)
pub extern "c" fn MountOperation::set_anonymous(
  self : MountOperation,
  anonymous : Bool,
) = "moonbit_g_mount_operation_set_anonymous"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.set_choice.html).
#borrow(self)
pub extern "c" fn MountOperation::set_choice(
  self : MountOperation,
  choice : Int,
) = "moonbit_g_mount_operation_set_choice"

///|
#borrow(self_, domain)
extern "c" fn moonbit_g_mount_operation_set_domain(
  self_ : MountOperation,
  domain : @glib.Nullable[Bytes],
) = "moonbit_g_mount_operation_set_domain"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.set_domain.html).
pub fn MountOperation::set_domain(
  self : MountOperation,
  domain : String?,
) -> Unit {
  moonbit_g_mount_operation_set_domain(
    self,
    match domain {
      Some(s) => @glib.Nullable::some(@encoding/utf8.encode(s))
      None => @glib.Nullable::null()
    },
  )
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.set_is_tcrypt_hidden_volume.html).
#borrow(self)
pub extern "c" fn MountOperation::set_is_tcrypt_hidden_volume(
  self : MountOperation,
  hidden_volume : Bool,
) = "moonbit_g_mount_operation_set_is_tcrypt_hidden_volume"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.set_is_tcrypt_system_volume.html).
#borrow(self)
pub extern "c" fn MountOperation::set_is_tcrypt_system_volume(
  self : MountOperation,
  system_volume : Bool,
) = "moonbit_g_mount_operation_set_is_tcrypt_system_volume"

///|
#borrow(self_, password)
extern "c" fn moonbit_g_mount_operation_set_password(
  self_ : MountOperation,
  password : @glib.Nullable[Bytes],
) = "moonbit_g_mount_operation_set_password"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.set_password.html).
pub fn MountOperation::set_password(
  self : MountOperation,
  password : String?,
) -> Unit {
  moonbit_g_mount_operation_set_password(
    self,
    match password {
      Some(s) => @glib.Nullable::some(@encoding/utf8.encode(s))
      None => @glib.Nullable::null()
    },
  )
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.set_password_save.html).
#borrow(self)
pub extern "c" fn MountOperation::set_password_save(
  self : MountOperation,
  save : PasswordSave,
) = "moonbit_g_mount_operation_set_password_save"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.set_pim.html).
#borrow(self)
pub extern "c" fn MountOperation::set_pim(self : MountOperation, pim : UInt) = "moonbit_g_mount_operation_set_pim"

///|
#borrow(self_, username)
extern "c" fn moonbit_g_mount_operation_set_username(
  self_ : MountOperation,
  username : @glib.Nullable[Bytes],
) = "moonbit_g_mount_operation_set_username"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.MountOperation.set_username.html).
pub fn MountOperation::set_username(
  self : MountOperation,
  username : String?,
) -> Unit {
  moonbit_g_mount_operation_set_username(
    self,
    match username {
      Some(s) => @glib.Nullable::some(@encoding/utf8.encode(s))
      None => @glib.Nullable::null()
    },
  )
}

///|
#borrow(instance)
extern "c" fn g_mount_operation_connect_aborted(
  instance : MountOperation,
  function : FuncRef[(MountOperation, (MountOperation) -> Unit) -> Unit],
  closure : (MountOperation) -> Unit,
) -> UInt64 = "moonbit_g_mount_operation_connect_aborted"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/signal.MountOperation.aborted.html).
pub fn MountOperation::connect_aborted(
  self : MountOperation,
  f : (MountOperation) -> Unit,
) -> UInt64 {
  g_mount_operation_connect_aborted(self, fn(instance_, f) { f(instance_) }, f)
}

///|
#borrow(instance)
extern "c" fn g_mount_operation_connect_ask_password(
  instance : MountOperation,
  function : FuncRef[
    (
      MountOperation,
      Bytes,
      Bytes,
      Bytes,
      Int,
      (MountOperation, String, String, String, AskPasswordFlags) -> Unit,
    ) -> Unit,
  ],
  closure : (MountOperation, String, String, String, AskPasswordFlags) -> Unit,
) -> UInt64 = "moonbit_g_mount_operation_connect_ask_password"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/signal.MountOperation.ask-password.html).
pub fn MountOperation::connect_ask_password(
  self : MountOperation,
  f : (MountOperation, String, String, String, AskPasswordFlags) -> Unit,
) -> UInt64 {
  g_mount_operation_connect_ask_password(
    self,
    fn(instance_, message, default_user, default_domain, flags, f) {
      f(
        instance_,
        @encoding/utf8.decode_lossy(message),
        @encoding/utf8.decode_lossy(default_user),
        @encoding/utf8.decode_lossy(default_domain),
        AskPasswordFlags::from_int(flags),
      )
    },
    f,
  )
}

///|
#borrow(instance)
extern "c" fn g_mount_operation_connect_reply(
  instance : MountOperation,
  function : FuncRef[
    (
      MountOperation,
      MountOperationResult,
      (MountOperation, MountOperationResult) -> Unit,
    ) -> Unit,
  ],
  closure : (MountOperation, MountOperationResult) -> Unit,
) -> UInt64 = "moonbit_g_mount_operation_connect_reply"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/signal.MountOperation.reply.html).
pub fn MountOperation::connect_reply(
  self : MountOperation,
  f : (MountOperation, MountOperationResult) -> Unit,
) -> UInt64 {
  g_mount_operation_connect_reply(
    self,
    fn(instance_, result, f) { f(instance_, result) },
    f,
  )
}

///|
#borrow(instance)
extern "c" fn g_mount_operation_connect_show_unmount_progress(
  instance : MountOperation,
  function : FuncRef[
    (
      MountOperation,
      Bytes,
      Int64,
      Int64,
      (MountOperation, String, Int64, Int64) -> Unit,
    ) -> Unit,
  ],
  closure : (MountOperation, String, Int64, Int64) -> Unit,
) -> UInt64 = "moonbit_g_mount_operation_connect_show_unmount_progress"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/signal.MountOperation.show-unmount-progress.html).
pub fn MountOperation::connect_show_unmount_progress(
  self : MountOperation,
  f : (MountOperation, String, Int64, Int64) -> Unit,
) -> UInt64 {
  g_mount_operation_connect_show_unmount_progress(
    self,
    fn(instance_, message, time_left, bytes_left, f) {
      f(instance_, @encoding/utf8.decode_lossy(message), time_left, bytes_left)
    },
    f,
  )
}

///|
impl IMountOperation with fn get_anonymous(self) -> Bool {
  self.as_mount_operation().get_anonymous()
}

///|
impl IMountOperation with fn get_choice(self) -> Int {
  self.as_mount_operation().get_choice()
}

///|
impl IMountOperation with fn get_domain(self) -> String? {
  self.as_mount_operation().get_domain()
}

///|
impl IMountOperation with fn get_is_tcrypt_hidden_volume(self) -> Bool {
  self.as_mount_operation().get_is_tcrypt_hidden_volume()
}

///|
impl IMountOperation with fn get_is_tcrypt_system_volume(self) -> Bool {
  self.as_mount_operation().get_is_tcrypt_system_volume()
}

///|
impl IMountOperation with fn get_password(self) -> String? {
  self.as_mount_operation().get_password()
}

///|
impl IMountOperation with fn get_password_save(self) -> PasswordSave {
  self.as_mount_operation().get_password_save()
}

///|
impl IMountOperation with fn get_pim(self) -> UInt {
  self.as_mount_operation().get_pim()
}

///|
impl IMountOperation with fn get_username(self) -> String? {
  self.as_mount_operation().get_username()
}

///|
impl IMountOperation with fn reply(self, result) -> Unit {
  self.as_mount_operation().reply(result)
}

///|
impl IMountOperation with fn set_anonymous(self, anonymous) -> Unit {
  self.as_mount_operation().set_anonymous(anonymous)
}

///|
impl IMountOperation with fn set_choice(self, choice) -> Unit {
  self.as_mount_operation().set_choice(choice)
}

///|
impl IMountOperation with fn set_domain(self, domain) -> Unit {
  self.as_mount_operation().set_domain(domain)
}

///|
impl IMountOperation with fn set_is_tcrypt_hidden_volume(self, hidden_volume) -> Unit {
  self.as_mount_operation().set_is_tcrypt_hidden_volume(hidden_volume)
}

///|
impl IMountOperation with fn set_is_tcrypt_system_volume(self, system_volume) -> Unit {
  self.as_mount_operation().set_is_tcrypt_system_volume(system_volume)
}

///|
impl IMountOperation with fn set_password(self, password) -> Unit {
  self.as_mount_operation().set_password(password)
}

///|
impl IMountOperation with fn set_password_save(self, save) -> Unit {
  self.as_mount_operation().set_password_save(save)
}

///|
impl IMountOperation with fn set_pim(self, pim) -> Unit {
  self.as_mount_operation().set_pim(pim)
}

///|
impl IMountOperation with fn set_username(self, username) -> Unit {
  self.as_mount_operation().set_username(username)
}

///|
impl IMountOperation with fn connect_aborted(self, f) -> UInt64 {
  self.as_mount_operation().connect_aborted(f)
}

///|
impl IMountOperation with fn connect_ask_password(self, f) -> UInt64 {
  self.as_mount_operation().connect_ask_password(f)
}

///|
impl IMountOperation with fn connect_reply(self, f) -> UInt64 {
  self.as_mount_operation().connect_reply(f)
}

///|
impl IMountOperation with fn connect_show_unmount_progress(self, f) -> UInt64 {
  self.as_mount_operation().connect_show_unmount_progress(f)
}

///|
pub fn MountOperation::as_gobject_object(
  self : MountOperation,
) -> @gobject.Object = "%identity"

///|
pub impl @gobject.IObject for MountOperation with fn as_object(self) {
  self.as_gobject_object()
}