///|
/// Parser and traversal resource limits.
pub struct Limits {
  max_input_bytes : Int
  max_members : Int
  max_extension_members : Int
  max_string_bytes : Int
  max_title_bytes : Int
  max_detail_bytes : Int
  max_nesting_depth : Int
} derive(Eq, Debug)

///|
pub fn Limits::default() -> Limits {
  {
    max_input_bytes: 1_048_576,
    max_members: 256,
    max_extension_members: 240,
    max_string_bytes: 262_144,
    max_title_bytes: 8_192,
    max_detail_bytes: 65_536,
    max_nesting_depth: 64,
  }
}

///|
pub fn Limits::strict() -> Limits {
  {
    max_input_bytes: 16_384,
    max_members: 64,
    max_extension_members: 48,
    max_string_bytes: 8_192,
    max_title_bytes: 512,
    max_detail_bytes: 4_096,
    max_nesting_depth: 16,
  }
}

///|
pub fn Limits::permissive() -> Limits {
  {
    max_input_bytes: 8_388_608,
    max_members: 4_096,
    max_extension_members: 4_000,
    max_string_bytes: 2_097_152,
    max_title_bytes: 65_536,
    max_detail_bytes: 1_048_576,
    max_nesting_depth: 128,
  }
}

///|
pub fn Limits::max_input_bytes(self : Limits) -> Int {
  self.max_input_bytes
}

///|
pub fn Limits::max_members(self : Limits) -> Int {
  self.max_members
}

///|
pub fn Limits::max_extension_members(self : Limits) -> Int {
  self.max_extension_members
}

///|
pub fn Limits::max_string_bytes(self : Limits) -> Int {
  self.max_string_bytes
}

///|
pub fn Limits::max_title_bytes(self : Limits) -> Int {
  self.max_title_bytes
}

///|
pub fn Limits::max_detail_bytes(self : Limits) -> Int {
  self.max_detail_bytes
}

///|
pub fn Limits::max_nesting_depth(self : Limits) -> Int {
  self.max_nesting_depth
}