import { type Base, genBase } from "./_base"

export interface Medicine extends Base {
  code: string
  name: string
  medicineGroup_code: string
  medicineMethod_code: string
  uom_code: string
  infra_id?: string | null
  stock: number
}

export interface CreateDto  {
  code: string
  name: string
  medicineGroup_code: string
  medicineMethod_code: string
  uom_code: string
  infra_id?: string | null
  stock: number
}

export interface UpdateDto extends CreateDto {
  id: number
}

export interface GetListDto {
  page: number
  size: number
  name?: string
  code?: string
  medicineGroup_code?: string
  medicineMethod_code?: string
  uom_code?: string
  type?: string
  dose?: string
  infra_id?: string
  stock?: string
  status?: string
}

export interface GetDetailDto {
  id: number
}

export interface UpdateDto extends CreateDto {
  id: number
}

export interface DeleteDto {
  id: number
}

export function genMedicine(): Medicine {
  return {
    ...genBase(),
    name: 'name',
    code: 'code',
    medicineGroup_code: 'medicineGroup_code',
    medicineMethod_code: 'medicineMethod_code',
    uom_code: 'uom_code',
    infra_id: null,
    stock: 0
  }
}
