// GENERATED — DO NOT EDIT

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

///|
pub(open) trait ITlsServerConnection {
  fn as_tls_server_connection(Self) -> TlsServerConnection
}

///|
pub impl ITlsServerConnection for TlsServerConnection with fn as_tls_server_connection(
  self,
) {
  self
}

///|
#borrow(base_io_stream, certificate, error)
extern "c" fn moonbit_g_tls_server_connection_new(
  base_io_stream : IOStream,
  certificate : @glib.Nullable[TlsCertificate],
  error : Ref[@glib.Nullable[@glib.Error_]],
) -> TlsServerConnection = "moonbit_g_tls_server_connection_new"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/type_func.TlsServerConnection.new.html).
pub fn TlsServerConnection::new(
  base_io_stream : &IIOStream,
  certificate : &ITlsCertificate?,
) -> TlsServerConnection raise @glib.Error_ {
  let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
  let result = moonbit_g_tls_server_connection_new(
    base_io_stream.as_io_stream(),
    match certificate {
      Some(v) => @glib.Nullable::some(v.as_tls_certificate())
      None => @glib.Nullable::null()
    },
    error_,
  )
  match error_.val.to_option() {
    Some(e) => raise e
    None => result
  }
}

///|
pub fn TlsServerConnection::as_tls_connection(
  self : TlsServerConnection,
) -> TlsConnection = "%identity"

///|
pub impl ITlsConnection for TlsServerConnection with fn as_tls_connection(self) {
  self.as_tls_connection()
}