import type { PageParam, PageResult } from '@vben/request';

import { requestClient } from '#/api/request';

export namespace AssetVehiclePrepareApi {
  export interface VehiclePrepare {
    id?: number;
    vehicleId: number;
    plateNo?: string;
    vin?: string;
    vehicleType?: string;
    vehicleModelId?: number;
    brand?: string;
    model?: string;
    contractId?: number;
    contractCode?: string;
    parkingLot?: string;
    hasBodyAd?: boolean;
    bodyAdPhoto?: string;
    enlargedTextPhoto?: string;
    hasTailLift?: boolean;
    spareTireDepth?: number;
    spareTirePhoto?: string;
    defectPhotos?: string;
    trailerPlateNo?: string;
    checkList?: string;
    inspectionRecordId?: number;
    status?: number;
    completeTime?: Date;
    creator?: string;
    createTime?: Date;
  }
}

export function getVehiclePreparePage(params: PageParam) {
  return requestClient.get<PageResult<AssetVehiclePrepareApi.VehiclePrepare>>(
    '/asset/vehicle-prepare/page',
    { params },
  );
}

export function getVehiclePrepare(id: number) {
  return requestClient.get<AssetVehiclePrepareApi.VehiclePrepare>(
    `/asset/vehicle-prepare/get?id=${id}`,
  );
}

export function createVehiclePrepare(data: AssetVehiclePrepareApi.VehiclePrepare) {
  return requestClient.post('/asset/vehicle-prepare/create', data);
}

export function updateVehiclePrepare(data: AssetVehiclePrepareApi.VehiclePrepare) {
  return requestClient.put('/asset/vehicle-prepare/update', data);
}

export function deleteVehiclePrepare(id: number) {
  return requestClient.delete(`/asset/vehicle-prepare/delete?id=${id}`);
}

export function completeVehiclePrepare(id: number) {
  return requestClient.put(`/asset/vehicle-prepare/complete?id=${id}`);
}
