// GENERATED — DO NOT EDIT

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/vte/gtk4/struct.Uuid.html).
pub type Uuid

///|
pub(open) trait IUuid {
  fn as_uuid(Self) -> Uuid
  fn dup(Self) -> Uuid = _
  fn equal(Self, Uuid) -> Bool = _
  fn new_v5(Self, String, Int64) -> Uuid = _
  fn to_string(Self, UuidFormat) -> (String, UInt64) = _
}

///|
pub impl IUuid for Uuid with fn as_uuid(self) {
  self
}

///|
#borrow(str)
extern "c" fn moonbit_vte_uuid_new_from_string(
  str : Bytes,
  len : Int64,
  fmt : Int,
) -> @glib.Nullable[Uuid] = "moonbit_vte_uuid_new_from_string"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/vte/gtk4/ctor.Uuid.new_from_string.html).
pub fn Uuid::new_from_string(
  str : String,
  len : Int64,
  fmt : UuidFormat,
) -> Uuid? {
  let raw_result = moonbit_vte_uuid_new_from_string(
    @encoding/utf8.encode(str),
    len,
    fmt.to_int(),
  )
  raw_result.to_option()
}

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/vte/gtk4/ctor.Uuid.new_v4.html).
pub extern "c" fn Uuid::new_v4() -> Uuid = "moonbit_vte_uuid_new_v4"

///|
#borrow(str)
extern "c" fn moonbit_vte_uuid_validate_string(
  str : Bytes,
  len : Int64,
  fmt : Int,
) -> Bool = "moonbit_vte_uuid_validate_string"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/vte/gtk4/type_func.Uuid.validate_string.html).
pub fn Uuid::validate_string(
  str : String,
  len : Int64,
  fmt : UuidFormat,
) -> Bool {
  moonbit_vte_uuid_validate_string(
    @encoding/utf8.encode(str),
    len,
    fmt.to_int(),
  )
}

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/vte/gtk4/method.Uuid.dup.html).
#borrow(self)
pub extern "c" fn Uuid::dup(self : Uuid) -> Uuid = "moonbit_vte_uuid_dup"

///|
#borrow(self_, other)
extern "c" fn moonbit_vte_uuid_equal(self_ : Uuid, other : Uuid) -> Bool = "moonbit_vte_uuid_equal"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/vte/gtk4/method.Uuid.equal.html).
pub fn Uuid::equal(self : Uuid, other : Uuid) -> Bool {
  moonbit_vte_uuid_equal(self, other)
}

///|
#borrow(self_, data)
extern "c" fn moonbit_vte_uuid_new_v5(
  self_ : Uuid,
  data : Bytes,
  len : Int64,
) -> Uuid = "moonbit_vte_uuid_new_v5"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/vte/gtk4/method.Uuid.new_v5.html).
pub fn Uuid::new_v5(self : Uuid, data : String, len : Int64) -> Uuid {
  moonbit_vte_uuid_new_v5(self, @encoding/utf8.encode(data), len)
}

///|
#borrow(self_, len)
extern "c" fn moonbit_vte_uuid_to_string(
  self_ : Uuid,
  fmt : Int,
  len : Ref[UInt64],
) -> Bytes = "moonbit_vte_uuid_to_string"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/vte/gtk4/method.Uuid.to_string.html).
pub fn Uuid::to_string(self : Uuid, fmt : UuidFormat) -> (String, UInt64) {
  let len = Ref(0UL)
  let result = @encoding/utf8.decode_lossy(
    moonbit_vte_uuid_to_string(self, fmt.to_int(), len),
  )
  (result, len.val)
}

///|
impl IUuid with fn dup(self) -> Uuid {
  self.as_uuid().dup()
}

///|
impl IUuid with fn equal(self, other) -> Bool {
  self.as_uuid().equal(other)
}

///|
impl IUuid with fn new_v5(self, data, len) -> Uuid {
  self.as_uuid().new_v5(data, len)
}

///|
impl IUuid with fn to_string(self, fmt) -> (String, UInt64) {
  self.as_uuid().to_string(fmt)
}