export type Role = 'admin' | 'redteam' | 'soc';

export type EngagementStatus = 'planned' | 'active' | 'closed';

export interface User {
  id: number;
  username: string;
  role: Role;
  created_at: string;
}

export interface LoginResponse {
  access_token: string;
  user: Pick<User, 'id' | 'username' | 'role'>;
}

export interface EngagementCreatedBy {
  id: number;
  username: string;
}

export interface Engagement {
  id: number;
  name: string;
  description: string | null;
  start_date: string;
  end_date: string | null;
  status: EngagementStatus;
  created_at: string;
  created_by: EngagementCreatedBy;
}

export interface EngagementInput {
  name: string;
  description?: string;
  start_date: string;
  end_date?: string | null;
  status?: EngagementStatus;
}

export interface UserCreateInput {
  username: string;
  password: string;
  role: Role;
}

export interface UserPatchInput {
  role?: Role;
  password?: string;
}

export interface ApiError {
  error: string;
}

export type SimulationStatus = 'pending' | 'in_progress' | 'review_required' | 'done';

export interface MitreTechnique {
  id: string;
  name: string;
  tactics: string[];
}

export interface Simulation {
  id: number;
  engagement_id: number;
  name: string;
  mitre_technique_id: string | null;
  mitre_technique_name: string | null;
  description: string | null;
  commands: string | null;
  prerequisites: string | null;
  executed_at: string | null;
  execution_result: string | null;
  log_source: string | null;
  logs: string | null;
  soc_comment: string | null;
  incident_number: string | null;
  status: SimulationStatus;
  created_at: string;
  updated_at: string | null;
  created_by: { id: number; username: string };
}

export interface SimulationCreateInput {
  name: string;
}

export interface SimulationPatchInput {
  name?: string;
  mitre_technique_id?: string | null;
  mitre_technique_name?: string | null;
  description?: string | null;
  commands?: string | null;
  prerequisites?: string | null;
  executed_at?: string | null;
  execution_result?: string | null;
  log_source?: string | null;
  logs?: string | null;
  soc_comment?: string | null;
  incident_number?: string | null;
}
