// Generated by Lisette bindgen
// Source: net/mail (Go stdlib)
// Go: 1.25.5
// Lisette: 0.1.20

import "go:io"
import "go:mime"
import "go:time"

pub fn ParseAddress(address: string) -> Result<Ref<Address>, error>

pub fn ParseAddressList(list: string) -> Result<Slice<Ref<Address>>, error>

/// ParseDate parses an RFC 5322 date string.
pub fn ParseDate(date: string) -> Result<time.Time, error>

pub fn ReadMessage(r: io.Reader) -> Result<Ref<Message>, error>

/// Address represents a single mail address.
/// An address such as "Barry Gibbs <bg@example.com>" is represented
/// as Address{Name: "Barry Gibbs", Address: "bg@example.com"}.
pub struct Address {
  pub Name: string,
  pub Address: string,
}

/// An AddressParser is an RFC 5322 address parser.
pub struct AddressParser {
  pub WordDecoder: Option<Ref<mime.WordDecoder>>,
}

/// A Header represents the key-value pairs in a mail message header.
pub struct Header(Map<string, Slice<string>>)

/// A Message represents a parsed mail message.
pub struct Message {
  pub Header: Header,
  pub Body: Option<io.Reader>,
}

pub var ErrHeaderNotPresent: error

impl Address {
  /// String formats the address as a valid RFC 5322 address.
  /// If the address's name contains non-ASCII characters
  /// the name will be rendered according to RFC 2047.
  fn String(self: Ref<Address>) -> string
}

impl AddressParser {
  /// Parse parses a single RFC 5322 address of the
  /// form "Gogh Fir <gf@example.com>" or "foo@example.com".
  fn Parse(self: Ref<AddressParser>, address: string) -> Result<Ref<Address>, error>

  /// ParseList parses the given string as a list of comma-separated addresses
  /// of the form "Gogh Fir <gf@example.com>" or "foo@example.com".
  fn ParseList(self: Ref<AddressParser>, list: string) -> Result<Slice<Ref<Address>>, error>
}

impl Header {
  /// AddressList parses the named header field as a list of addresses.
  fn AddressList(self, key: string) -> Result<Slice<Ref<Address>>, error>

  /// Date parses the Date header field.
  fn Date(self) -> Result<time.Time, error>

  /// Get gets the first value associated with the given key.
  /// It is case insensitive; CanonicalMIMEHeaderKey is used
  /// to canonicalize the provided key.
  /// If there are no values associated with the key, Get returns "".
  /// To access multiple values of a key, or to use non-canonical keys,
  /// access the map directly.
  fn Get(self, key: string) -> string
}
