<?php

namespace Modules\Billing\Http\Controllers;

use Illuminate\Http\Request;
use Modules\Billing\DTO\BillingSettingFilter;
use Modules\Billing\Services\ServiceDepartmentService;
use Modules\Billing\Transformers\ServiceDepartmentResource;
use Modules\Core\Helpers\ApiResponse;

class BillingLookupController extends ApiResponse
{
    public function __construct(
        protected ServiceDepartmentService $serviceDepartmentService
    ) {}

    public function serviceDepartmentList(Request $request)
    {
        $filter = BillingSettingFilter::fromRequest($request);
        $data = $this->serviceDepartmentService->list($filter);

        return (ServiceDepartmentResource::collection($data))->additional([
            'status' => true,
            'message' => 'Service departments retrieved successfully.',
        ]);
    }
}
