/**
 * Shared types between the API and the web dashboard.
 *
 * These are hand-maintained for now and will be generated from the FastAPI
 * OpenAPI schema in Phase 7. They mirror the Phase 1 domain model.
 */

export type Role = "owner" | "admin" | "builder" | "operator" | "viewer";

export interface User {
  id: string;
  email: string;
  name: string;
  is_active: boolean;
  is_superuser: boolean;
  created_at: string;
}

export interface Workspace {
  id: string;
  name: string;
  slug: string;
  plan: string;
  created_at: string;
}

export interface Membership {
  id: string;
  user_id: string;
  workspace_id: string;
  role: Role;
}

export interface TokenPair {
  access_token: string;
  refresh_token: string;
  token_type: "bearer";
}

export interface AuditEntry {
  id: string;
  seq: number;
  actor: string;
  action: string;
  target: string | null;
  metadata: Record<string, unknown>;
  hash: string;
  hash_prev: string | null;
  created_at: string;
}
