// GENERATED — DO NOT EDIT

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

///|
pub(open) trait IAction {
  fn as_action(Self) -> Action
  fn activate(Self, &@glib.IVariant?) -> Unit = _
  fn change_state(Self, &@glib.IVariant) -> Unit = _
  fn get_enabled(Self) -> Bool = _
  fn get_name(Self) -> String = _
  fn get_state(Self) -> @glib.Variant? = _
  fn get_state_hint(Self) -> @glib.Variant? = _
}

///|
pub impl IAction for Action with fn as_action(self) {
  self
}

///|
/// Implementation contract for Action.activate. Self is the retained MoonBit state; the second parameter is the invoked Action object.
pub(open) trait VActionActivate {
  fn activate(Self, Action, &@glib.IVariant?) -> Unit
}

///|
/// Implementation contract for Action.change_state. Self is the retained MoonBit state; the second parameter is the invoked Action object.
pub(open) trait VActionChangeState {
  fn change_state(Self, Action, &@glib.IVariant) -> Unit
}

///|
#borrow(action_name)
extern "c" fn moonbit_g_action_name_is_valid(action_name : Bytes) -> Bool = "moonbit_g_action_name_is_valid"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/type_func.Action.name_is_valid.html).
pub fn Action::name_is_valid(action_name : String) -> Bool {
  moonbit_g_action_name_is_valid(@encoding/utf8.encode(action_name))
}

///|
#borrow(action_name, target_value)
extern "c" fn moonbit_g_action_print_detailed_name(
  action_name : Bytes,
  target_value : @glib.Nullable[@glib.Variant],
) -> Bytes = "moonbit_g_action_print_detailed_name"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/type_func.Action.print_detailed_name.html).
pub fn Action::print_detailed_name(
  action_name : String,
  target_value : &@glib.IVariant?,
) -> String {
  @encoding/utf8.decode_lossy(
    moonbit_g_action_print_detailed_name(
      @encoding/utf8.encode(action_name),
      match target_value {
        Some(v) => @glib.Nullable::some(v.as_variant())
        None => @glib.Nullable::null()
      },
    ),
  )
}

///|
#borrow(self_, parameter)
extern "c" fn moonbit_g_action_activate(
  self_ : Action,
  parameter : @glib.Nullable[@glib.Variant],
) = "moonbit_g_action_activate"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Action.activate.html).
pub fn Action::activate(self : Action, parameter : &@glib.IVariant?) -> Unit {
  moonbit_g_action_activate(
    self,
    match parameter {
      Some(v) => @glib.Nullable::some(v.as_variant())
      None => @glib.Nullable::null()
    },
  )
}

///|
#borrow(self_, value)
extern "c" fn moonbit_g_action_change_state(
  self_ : Action,
  value : @glib.Variant,
) = "moonbit_g_action_change_state"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Action.change_state.html).
pub fn Action::change_state(self : Action, value : &@glib.IVariant) -> Unit {
  moonbit_g_action_change_state(self, value.as_variant())
}

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

///|
#borrow(self_)
extern "c" fn moonbit_g_action_get_name(self_ : Action) -> Bytes = "moonbit_g_action_get_name"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Action.get_name.html).
pub fn Action::get_name(self : Action) -> String {
  @encoding/utf8.decode_lossy(moonbit_g_action_get_name(self))
}

///|
#borrow(self_)
extern "c" fn moonbit_g_action_get_state(
  self_ : Action,
) -> @glib.Nullable[@glib.Variant] = "moonbit_g_action_get_state"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Action.get_state.html).
pub fn Action::get_state(self : Action) -> @glib.Variant? {
  let raw_result = moonbit_g_action_get_state(self)
  raw_result.to_option()
}

///|
#borrow(self_)
extern "c" fn moonbit_g_action_get_state_hint(
  self_ : Action,
) -> @glib.Nullable[@glib.Variant] = "moonbit_g_action_get_state_hint"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Action.get_state_hint.html).
pub fn Action::get_state_hint(self : Action) -> @glib.Variant? {
  let raw_result = moonbit_g_action_get_state_hint(self)
  raw_result.to_option()
}

///|
impl IAction with fn activate(self, parameter) -> Unit {
  self.as_action().activate(parameter)
}

///|
impl IAction with fn change_state(self, value) -> Unit {
  self.as_action().change_state(value)
}

///|
impl IAction with fn get_enabled(self) -> Bool {
  self.as_action().get_enabled()
}

///|
impl IAction with fn get_name(self) -> String {
  self.as_action().get_name()
}

///|
impl IAction with fn get_state(self) -> @glib.Variant? {
  self.as_action().get_state()
}

///|
impl IAction with fn get_state_hint(self) -> @glib.Variant? {
  self.as_action().get_state_hint()
}