// 员工类型
export type EmployeeType = 'intern' | 'fulltime' | 'parttime'

// 工资单状态
export type SalaryStatus = 'draft' | 'pending' | 'approved' | 'rejected' | 'paid'

// 补助类型
export interface AllowanceItem {
  type: string
  name: string
  amount: number
  unit: 'day' | 'project' | 'fixed'
  quantity: number
  total: number
}

// 绩效评价项
export interface PerformanceItem {
  id: string
  name: string
  weight: number
  score: number
  maxScore: number
  amount: number
  description?: string
}

// 工资记录
export interface SalaryRecord {
  id: string
  employeeId: string
  employeeName: string
  employeeType: EmployeeType
  idCard: string
  phone: string
  bankCard: string
  bankName: string

  // 项目信息
  projectName: string
  projectPeriod: string
  workDays: number
  offshoreDays: number

  // 薪酬结构
  baseSalary: number
  baseSalaryStandard: number
  performanceBonus: number
  allowances: number
  performanceItems: PerformanceItem[]
  allowanceItems: AllowanceItem[]

  // 计算结果
  totalPayable: number
  deductions: number
  netPay: number

  // 状态
  status: SalaryStatus
  approvalFlow: ApprovalStep[]

  // 时间
  salaryMonth: string
  createdAt: string
  updatedAt: string
}

// 审批步骤
export interface ApprovalStep {
  step: string
  role: string
  approver: string
  status: 'pending' | 'approved' | 'rejected'
  comment?: string
  date?: string
}

// 查询参数
export interface SalaryQuery {
  keyword?: string
  employeeType?: EmployeeType
  status?: SalaryStatus
  dateRange?: string[]
  projectName?: string
}

// 实习生专用配置
export interface InternConfig {
  baseSalaryStandard: {
    withCertification: number
    withoutCertification: number
  }
  performanceRates: {
    construction: number
    offshore: number
  }
  allowances: {
    offshoreCert: number
    towerWork: {
      land: {
        bladeInspection: number
        lightning: number
      }
      sea: {
        bladeInspection: number
        lightning: number
      }
    }
    droneWork: number
    meal: number
  }
}

// 工资单创建请求
export interface SalaryCreateRequest {
  employeeId: string
  projectId: string
  workDays: number
  offshoreDays: number
  performanceItems: Omit<PerformanceItem, 'id'>[]
  allowanceItems: Omit<AllowanceItem, 'total'>[]
  deductions?: {
    type: string
    amount: number
    reason: string
  }[]
}
