let perm_type     = [| 'High, 'Medium, 'Low, 'Closed |] in
let protocol_type = [| 'Observe, 'Absorb, 'Challenge, 'Reject |] in
let duration_type = [| 'Moment, 'Days, 'Weeks, 'Indefinite |] in

let signal_type = [|
  'FrameBreakingQuestion,
  'UsageFriction,
  'ProductiveMisunderstanding,
  'HardBug,
  'ContextlessInsight,
  'SignificantSilence,
  'ConnectsToPractice,
  'EcosystemRelevance,
  'DepthDemonstrated,
  'IdentityReinforcement,
  'OpportunityAlignment,
|] in

let opening_condition_type = {
  max_tension_dimensions | Number,
  pending_transitions    | Number,
  core_stable            | Bool,
  description            | String,
} in

{
  Permeability     = perm_type,
  Protocol         = protocol_type,
  Duration         = duration_type,
  SignalType        = signal_type,
  OpeningCondition = opening_condition_type,

  Membrane = {
    id                | String,
    name              | String,
    description       | String,
    permeability      | perm_type,
    accepts           | Array signal_type,
    protects          | Array String,
    opening_condition | opening_condition_type,
    closing_condition | String,
    protocol          | protocol_type,
    max_duration      | duration_type,
    active            | Bool | default = false,
  },

  GateConfig = {
    membranes | Array {
      id                | String,
      name              | String,
      description       | String,
      permeability      | perm_type,
      accepts           | Array signal_type,
      protects          | Array String,
      opening_condition | opening_condition_type,
      closing_condition | String,
      protocol          | protocol_type,
      max_duration      | duration_type,
      active            | Bool,
    },
  },
}
