import request from '@/config/axios'

export interface ProjectPlanningGuideDetailVO {
  id?: number
  planningId: number
  projectId?: number
  designPart?: string
  buildingType?: string
  designArea?: number
  internalGuidanceUnitPrice?: number
  buildingOrUnitCount?: number
  drawingSetFactor?: number
  scaleFactor?: number
  modificationFactor?: number
  complexityFactor?: number
  totalAdjustmentFactor?: number
  designRatio?: number
  assessmentArea?: number
  assessmentOutputValue?: number
  sortNo?: number
  remark?: string
  createTime?: string
}

export interface ProjectPlanningGuideDetailBatchSaveVO {
  planningId: number
  details: Array<
    Pick<
      ProjectPlanningGuideDetailVO,
      | 'id'
      | 'designPart'
      | 'buildingType'
      | 'designArea'
      | 'internalGuidanceUnitPrice'
      | 'buildingOrUnitCount'
      | 'drawingSetFactor'
      | 'scaleFactor'
      | 'modificationFactor'
      | 'complexityFactor'
      | 'designRatio'
      | 'sortNo'
      | 'remark'
    >
  >
}

export const getProjectPlanningGuideDetailListByPlanningId = (planningId: number) => {
  return request.get({ url: '/tjt/planning-guide-detail/list-by-planning', params: { planningId } })
}

export const batchSaveProjectPlanningGuideDetail = (
  data: ProjectPlanningGuideDetailBatchSaveVO
) => {
  return request.post({ url: '/tjt/planning-guide-detail/batch-save', data })
}

export const deleteProjectPlanningGuideDetail = (id: number) => {
  return request.delete({ url: '/tjt/planning-guide-detail/delete', params: { id } })
}
