export interface CompanyRecord {
  id: string;
  name: string;
  code: string;
  email_domain: string | null;
  logo_url: string | null;
  is_active: boolean;
  departments_count?: number;
  users_count?: number;
}

export interface DepartmentRecord {
  id: string;
  company_id: string;
  name: string;
  code: string;
  slug: string | null;
  description: string | null;
  is_active: boolean;
  portal_enabled?: boolean;
  portal_description_en?: string | null;
  portal_description_ar?: string | null;
  portal_requires_membership?: boolean;
  portal_theme?: Record<string, unknown> | null;
  portal_url?: string | null;
  company?: { id: string; name: string; code: string };
  users_count?: number;
  heads_count?: number;
  heads?: { id: string; name: string; email: string }[];
}

export interface UserDepartmentAssignment {
  id: string;
  name: string;
  code: string;
  role: string;
  is_manager: boolean;
  is_department_head?: boolean;
  is_primary?: boolean;
}

export interface UserRecord {
  id: string;
  name: string;
  email: string;
  company_id: string;
  is_super_admin: boolean;
  is_active: boolean;
  locale: string;
  timezone: string;
  departments?: UserDepartmentAssignment[];
  roles?: { id: string; name: string; scope: string }[];
}

export interface CategoryRecord {
  id: string;
  department_id: string;
  name_en: string;
  name_ar: string;
  description_en: string | null;
  description_ar: string | null;
  icon: string | null;
  sla_policy_id: string | null;
  is_active: boolean;
  sort_order: number;
  subcategories?: SubcategoryRecord[];
}

export interface SubcategoryRecord {
  id: string;
  category_id: string;
  name_en: string;
  name_ar: string;
  is_active: boolean;
  sort_order: number;
  sla_policy_id: string | null;
}

export interface SlaPolicyFormData {
  department_id: string;
  name_en: string;
  name_ar: string;
  description?: string | null;
  is_active: boolean;
  priority_id?: string | null;
  response_time_minutes: number;
  resolution_time_minutes: number;
  business_hours_only?: boolean;
}
