///|
/// Parsed representation of a GenBank or INSDC flat-file record.
pub struct Record {
  accession : String
  version : String
  locus : Locus
  definition : String
  keywords : String
  source : String
  features : Array[Feature]
  origin : String
} derive(Debug, Eq)

///|
/// Information extracted from the LOCUS line.
pub struct Locus {
  name : String
  length : Int
  molecule_type : String
  topology : String
  division : String
  date : String
} derive(Debug, Eq)

///|
/// A feature-table entry such as `source`, `gene`, or `CDS`.
pub struct Feature {
  key : String
  location : Location
  qualifiers : Array[Qualifier]
} derive(Debug, Eq)

///|
/// Location text is preserved exactly enough for round-trip inspection and
/// exposes common numeric spans for simple queries.
pub struct Location {
  raw : String
  ranges : Array[Range]
  complement : Bool
  joined : Bool
  ordered : Bool
  segments : Array[LocationSegment]
} derive(Debug, Eq)

///|
/// One ordered segment in a feature location expression.
pub struct LocationSegment {
  range : Range
  reverse : Bool
  remote : String?
} derive(Debug, Eq)

///|
/// A 1-based inclusive interval from a GenBank feature location.
pub struct Range {
  start : Int
  end : Int
  partial_start : Bool
  partial_end : Bool
  between : Bool
} derive(Debug, Eq)

///|
/// A slash-prefixed feature qualifier such as `/gene="lacZ"`.
pub struct Qualifier {
  name : String
  value : String?
} derive(Debug, Eq)

///|
/// CDS validation status for `/translation` qualifiers.
pub struct TranslationCheck {
  feature_index : Int
  location : String
  expected : String
  actual : String
  ok : Bool
} derive(Debug, Eq)

///|
pub struct SequenceStats {
  length : Int
  a : Int
  c : Int
  g : Int
  t : Int
  n : Int
  gc_percent : Double
} derive(Debug, Eq)

///|
/// Severity of a structural record audit finding.
pub enum ValidationSeverity {
  Error
  Warning
} derive(Debug, Eq)

///|
/// A deterministic audit finding for a parsed record.
pub struct ValidationIssue {
  code : String
  message : String
  severity : ValidationSeverity
} derive(Debug, Eq)

///|
pub(all) suberror GenBankError {
  MissingSection(String)
  InvalidLocus(String)
  InvalidLocation(String)
  InvalidNumber(String)
} derive(Debug, Eq)