import request from '@/config/axios'

export interface OfficeVO {
  id?: number
  officeName: string
  officeCode?: string
  sortNo?: number
  enabledFlag?: boolean
  remark?: string
  createTime?: string
}

export interface OfficePageReqVO extends PageParam {
  officeName?: string
  enabledFlag?: boolean
}

export interface OfficeSimpleVO {
  id: number
  officeName: string
}

export const getOfficePage = (params: OfficePageReqVO) => {
  return request.get({ url: '/tjt/office/page', params })
}

export const getOffice = (id: number) => {
  return request.get({ url: '/tjt/office/get', params: { id } })
}

export const createOffice = (data: OfficeVO) => {
  return request.post({ url: '/tjt/office/create', data })
}

export const updateOffice = (data: OfficeVO) => {
  return request.put({ url: '/tjt/office/update', data })
}

export const deleteOffice = (id: number) => {
  return request.delete({ url: '/tjt/office/delete', params: { id } })
}

export const getOfficeSimpleList = () => {
  return request.get({ url: '/tjt/office/simple-list' })
}
