export interface DeptOption {
  label: string
  value: number
}

export interface OperationMeeting {
  id?: number
  deptId?: number
  companyName?: string
  meetingDate: number
  meetingSeries: string
  support: string
  cumulative: boolean
}

export interface OperationMeetingForm
  extends Omit<Partial<OperationMeeting>, 'meetingDate' | 'meetingSeries'> {
  meetingDate?: number | string | Date
  meetingSeries?: number
}

export interface OperationMeetingFormItem {
  key: string
  meeting: OperationMeetingForm
  details: DetailItem[]
  extProperty: ExtPropertyItem[]
  beforeRevenue: number | undefined // 上期收入
  beforeOnAccount: number | undefined // 上期挂帐
  beforePayment: number | undefined // 上期回款
}

export type ExtPropertyActualValue = string | number | null | undefined

export interface ExtPropertyItem {
  name: string
  identifier: string
  dataType: string
  required: number | string | boolean
  unit?: string
  accessMode?: string
  defaultValue?: string
  maxValue?: string | number
  minValue?: string | number
  sort?: number
  actualValue?: ExtPropertyActualValue
  dropdownList?: unknown
}

export interface DetailItem {
  raw: Record<string, unknown>
  projectName: string
  currentRevenue: number | undefined // 本期收入
  cumulativeRevenue: number | undefined // 累计收入
  beforeRevenue: number | undefined // 上期收入
  currentOnAccount: number | undefined // 本期挂帐
  cumulativeOnAccount: number | undefined // 累计挂帐
  beforeOnAccount: number | undefined // 上期挂帐
  currentPayment: number | undefined // 本期回款
  cumulativePayment: number | undefined // 累计回款
  beforePayment: number | undefined // 上期回款
  plannedWorkload: string // 计划工作量
  actualCompletion: string // 实际完成
  equipmentUtilizationRate: number | undefined // 设备利用率
  keyWorkCompletion: string // 重点工作及完成情况
  problemsAnalysis: string // 存在问题及分析
  qhse: string // 设备、安全管理工作
  nextPlannedWorkload: string // 下期计划工作量
  priorityTasks: string // 重点工作事项
  extProperty: ExtPropertyItem[] // 扩展属性
}

export interface SummaryDetailItem extends DetailItem {
  summaryDetailKey: string
  meetingKey: string
  companyName: string
  companyFilterValue: string
  cumulative?: boolean
  deptId?: number
}

export interface OperationMeetingListItem {
  id: number
  deptId: number | undefined
  companyName: string
  meetingDate: number
  meetingSeries: string
  support?: string
}

export type OperationMeetingOpenType = 'create' | 'edit' | 'readonly'
export type OperationMeetingDrawerMode = 'fill' | 'summary'
