import request from '@/config/axios'

export interface ProjectOutputSplitVO {
  id?: number
  projectId?: number
  planningId: number
  projectName?: string
  planningContent?: string
  year?: number
  assessmentOutputValue?: number
  projectManagerName?: string
  engineeringLeaderName?: string
  projectLeadName?: string
  projectLeadRatio: number
  projectLeadAmount?: number
  officeRatio: number
  officeAmount?: number
  archRatio: number
  archAmount?: number
  decorRatio: number
  decorAmount?: number
  structRatio: number
  structAmount?: number
  waterRatio: number
  waterAmount?: number
  elecRatio: number
  elecAmount?: number
  hvacRatio: number
  hvacAmount?: number
  digitalRatio: number
  digitalAmount?: number
}

export type ProjectOutputSplitSaveVO = Pick<
  ProjectOutputSplitVO,
  | 'planningId'
  | 'projectLeadRatio'
  | 'officeRatio'
  | 'archRatio'
  | 'decorRatio'
  | 'structRatio'
  | 'waterRatio'
  | 'elecRatio'
  | 'hvacRatio'
  | 'digitalRatio'
>

export const getProjectOutputSplitByPlanningId = (planningId: number) => {
  return request.get({ url: '/tjt/output-split/get-by-planning', params: { planningId } })
}

export const saveProjectOutputSplit = (data: ProjectOutputSplitSaveVO) => {
  return request.put({ url: '/tjt/output-split/save', data })
}
