<?php

namespace App\Classes\Modules\FreightForwarder\Services;


use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
use App\Models\ServiceFees;

class DeletesServiceFees
{
    /** @var  ServiceFees */
    private $repository;

    /**
     * DeletesServiceFees constructor.
     * @param ServiceFees $repository
     */
    public function __construct(ServiceFees $repository)
    {
        $this->repository = $repository;
    }

    public function execute(String $serviceId){
        try{

            $repository = $this->repository->findOrFail($serviceId);
            $repository->delete();

        }catch(\Exception $exception){
            throw new InternalServerErrorException("Failed to delete Customer Relation because{$exception->getMessage()}");
        }
    }
}