// Common types used across the SIGEP platform

export interface User {
  id: string;
  name: string;
  email: string;
  avatar?: string;
  role: string;
  ministry?: string;
}

export interface Agent {
  id: string;
  employeeNumber: string;
  fullName: string;
  email: string;
  phone: string;
  ministry: string;
  unit: string;
  position: string;
  category: string;
  status: AgentStatus;
  hireDate: string;
  salary: number;
  avatar?: string;
}

export type AgentStatus = 'active' | 'inactive' | 'suspended' | 'retired' | 'terminated';

export interface Ministry {
  id: string;
  name: string;
  abbreviation: string;
  minister: string;
  units: number;
  employees: number;
  status: 'active' | 'inactive';
}

export interface OrganizationalUnit {
  id: string;
  name: string;
  code: string;
  ministryId: string;
  parentId?: string;
  type: 'direction' | 'department' | 'division' | 'section';
  head?: string;
  employees: number;
  children?: OrganizationalUnit[];
}

export interface Position {
  id: string;
  name: string;
  code: string;
  category: string;
  level: number;
  baseSalary: number;
  status: 'active' | 'inactive';
}

export interface Contract {
  id: string;
  agentId: string;
  type: 'permanent' | 'fixed-term' | 'temporary' | 'internship';
  startDate: string;
  endDate?: string;
  position: string;
  salary: number;
  status: 'active' | 'expired' | 'terminated';
}

export interface BankAccount {
  id: string;
  agentId: string;
  bankName: string;
  bankCode: string;
  accountNumber: string;
  iban: string;
  isPrimary: boolean;
}

export interface SalaryGrade {
  id: string;
  category: string;
  level: number;
  step: number;
  baseSalary: number;
  allowances: number;
  totalSalary: number;
}

export interface PayrollPeriod {
  id: string;
  name: string;
  month: number;
  year: number;
  status: PayrollStatus;
  totalEmployees: number;
  totalGross: number;
  totalNet: number;
  processedAt?: string;
}

export type PayrollStatus = 'draft' | 'processing' | 'approved' | 'paid' | 'cancelled';

export interface PayrollRun {
  id: string;
  periodId: string;
  periodName: string;
  status: PayrollStatus;
  totalEmployees: number;
  totalGross: number;
  totalDeductions: number;
  totalNet: number;
  createdAt: string;
  processedAt?: string;
  approvedAt?: string;
}

export interface PayrollItem {
  id: string;
  payrollRunId: string;
  agentId: string;
  agentName: string;
  employeeNumber: string;
  baseSalary: number;
  allowances: number;
  deductions: number;
  netSalary: number;
  status: 'pending' | 'processed' | 'paid';
}

export interface FiscalYear {
  id: string;
  name: string;
  startDate: string;
  endDate: string;
  status: 'planning' | 'active' | 'closed';
  totalBudget: number;
  executedBudget: number;
}

export interface BudgetLine {
  id: string;
  fiscalYearId: string;
  code: string;
  description: string;
  category: string;
  allocated: number;
  executed: number;
  available: number;
  status: 'active' | 'frozen' | 'closed';
}

export interface PaymentBatch {
  id: string;
  reference: string;
  description: string;
  status: PaymentBatchStatus;
  totalOrders: number;
  totalAmount: number;
  createdAt: string;
  sentAt?: string;
  paidAt?: string;
}

export type PaymentBatchStatus = 'pending' | 'sent' | 'processing' | 'completed' | 'rejected';

export interface PaymentOrder {
  id: string;
  batchId: string;
  reference: string;
  beneficiary: string;
  amount: number;
  bankAccount: string;
  status: 'pending' | 'sent' | 'paid' | 'rejected';
  processedAt?: string;
}

export interface Bank {
  id: string;
  name: string;
  code: string;
  swift: string;
  status: 'active' | 'inactive';
}

export interface AuditLog {
  id: string;
  userId: string;
  userName: string;
  action: string;
  entity: string;
  entityId: string;
  details: string;
  ipAddress: string;
  timestamp: string;
}

export interface NavigationItem {
  name: string;
  href: string;
  icon: React.ComponentType<{ className?: string }>;
  badge?: number;
  children?: NavigationItem[];
}

export interface Module {
  id: string;
  name: string;
  description: string;
  icon: React.ComponentType<{ className?: string }>;
  href: string;
  color: string;
  items: NavigationItem[];
}
