export type ContractType = 'annual' | 'quarterly' | 'monthly' | 'single'
export type ContractStatus = 'pending' | 'active' | 'expiring' | 'completed' | 'terminated'
export type PaymentStatus = 'unpaid' | 'partpaid' | 'paid' | 'overdue'
export type PaymentMethod = 'lump_sum' | 'installment' | 'monthly' | 'quarterly'

export interface PaymentPlan {
  id: string
  contractId?: string
  phase: number
  amount: number
  plannedDate: string
  actualDate?: string
  actualAmount?: number
  status: PaymentStatus
  remark?: string
}

export interface PaymentRecord {
  id: string
  contractId: string
  planId: string
  amount: number
  payDate: string
  payer?: string
  receiver?: string
  remark?: string
  createTime: string
}

export interface ContractAttachment {
  id: string
  name: string
  url: string
  size?: number
  createTime?: string
}

export interface Contract {
  id: string
  code: string
  name: string
  customerId: string
  customerName: string
  projectId?: string
  projectName?: string
  type: ContractType
  amount: number
  paidAmount: number
  paymentMethod: PaymentMethod
  startDate: string
  endDate: string
  signDate?: string
  serviceContent?: string
  remark?: string
  status: ContractStatus
  paymentPlans: PaymentPlan[]
  attachments: ContractAttachment[]
  createTime: string
  updateTime: string
}

export interface ContractSearchParams {
  keyword?: string
  status?: ContractStatus | ''
  customerId?: string
  pageNum?: number
  pageSize?: number
}

export interface ContractFormData {
  id?: string
  code: string
  name: string
  customerId: string
  projectId?: string
  type: ContractType
  amount: number
  paymentMethod: PaymentMethod
  startDate: string
  endDate: string
  signDate?: string
  serviceContent?: string
  remark?: string
  status: ContractStatus
  paymentPlans: PaymentPlan[]
}
