export interface AgentRule {
  readonly id: string;
  readonly description: string;
  readonly severity: "mandatory" | "recommended" | "optional";
}

export interface EscalationCriterion {
  readonly condition: string;
  readonly action: "stop_and_report" | "report_to_architect" | "wait_for_approval";
}

export interface AgentContract {
  readonly id: string;
  readonly role_name: string;
  readonly purpose: string;
  readonly mode: "read-write" | "read-only";
  readonly dispatch_only: boolean;
  readonly can_read_artifacts: readonly string[];
  readonly can_write_artifacts: readonly string[];
  readonly can_execute_tools: readonly string[];
  readonly can_invoke_agents: readonly string[];
  readonly can_return_handoffs: readonly string[];
  readonly responsibilities: readonly string[];
  readonly constraints: readonly string[];
  readonly rules: readonly AgentRule[];
  readonly escalation_criteria: readonly EscalationCriterion[];
}

{{#each agentEntries}}
export const {{varName}}: AgentContract = {
  id: "{{id}}",
  role_name: "{{role_name}}",
  purpose: {{{json purpose}}},
  mode: "{{mode}}",
  dispatch_only: {{dispatch_only}},
  can_read_artifacts: {{{json can_read_artifacts}}},
  can_write_artifacts: {{{json can_write_artifacts}}},
  can_execute_tools: {{{json can_execute_tools}}},
  can_invoke_agents: {{{json can_invoke_agents}}},
  can_return_handoffs: {{{json can_return_handoffs}}},
  responsibilities: {{{json responsibilities}}},
  constraints: {{{json constraints}}},
  rules: {{{json rules}}},
  escalation_criteria: {{{json escalation_criteria}}},
} as const;

{{/each}}
export const agentRegistry: Record<string, AgentContract> = {
{{#each agentEntries}}
  "{{id}}": {{varName}},
{{/each}}
} as const;

export type AgentId = keyof typeof agentRegistry;
