import fuelPumpModel from "./fuelPump.model";
import { IFuelPump } from "./fuelPump.interface";

export class FuelPumpService {

    async getAll() {
        return await fuelPumpModel
        .find()
        .populate("fuelTypeId");
    }

    async getById(
        id:string
    ){
        return await fuelPumpModel.
        findById(id)
        .populate("fuelTypeId")
    }

    async create(
        data:IFuelPump
    ){
        return await fuelPumpModel.create(
            data
        );
    }

    async update(
        id:string,
        data:Partial<IFuelPump>
    ){
        return await fuelPumpModel.findByIdAndUpdate(
            id,
            data,
            {
                new:true
            }
        );
    }

    async delete(
        id:string
    ){
        return await fuelPumpModel.findByIdAndDelete(
            id
        );
    }
}
