import { UserRole } from '@/shared/types/app';

export interface BackendRole {
  readonly id?: string;
  readonly name?: string;
  readonly scope?: string | null;
  readonly globalAccess?: boolean;
}

export interface BackendOrganization {
  readonly id: string;
  readonly name?: string;
}

export interface BackendCampus {
  readonly id: string;
  readonly name?: string;
  readonly code?: string;
}

export interface BackendStaffProfile {
  readonly id: string;
  readonly employee_number?: string | null;
  readonly job_title?: string | null;
  readonly staff_type?: string | null;
  readonly status?: string | null;
  readonly organizationId?: string | null;
  readonly campusId?: string | null;
  readonly userId?: string | null;
}

export interface CurrentUser {
  readonly id: string;
  readonly email: string;
  /** Honorific title (e.g. `dr`); rendered before the name. */
  readonly name_prefix?: string | null;
  readonly firstName?: string | null;
  readonly lastName?: string | null;
  readonly app_role?: BackendRole | null;
  readonly organizations?: BackendOrganization | null;
  readonly organizationId?: string | null;
  readonly campus?: BackendCampus | null;
  readonly campusId?: string | null;
  readonly staffProfile?: BackendStaffProfile | null;
  readonly permissions?: readonly string[];
}

export interface SignInRequest {
  readonly email: string;
  readonly password: string;
}

export interface SignUpRequest extends SignInRequest {
  readonly fullName: string;
  readonly role: UserRole;
  readonly campus: string;
}
