// Base
import * as base from './_crud-base'

const path = '/api/vclaim-swagger/RencanaKontrol'
const name = 'rencana-kontrol'

export function getList(params: any = null) {
  let url = path
  console.log(params)
  if (params?.letterNumber && params.mode === 'by-control') {
    url += `/noSuratKontrol/${params.letterNumber}`
  }
  if (params?.letterNumber && params.mode === 'by-card') {
    url += `/noka/${params.letterNumber}`
  }
  if (params?.letterNumber && params.mode === 'by-sep') {
    url += `/${params.letterNumber}`
  }
  if (params?.controlDate && params.mode === 'by-schedule') {
    url += `/jadwalDokter?jeniskontrol=${params.controlType}&kodepoli=${params.polyCode}&tanggalkontrol=${params.controlDate}`
    delete params.controlType
    delete params.controlDate
    delete params.polyCode
  }
  if (params) {
    delete params.letterNumber
    delete params.mode
  }
  return base.getList(url, params, name)
}