<?php

namespace App\Http\Requests\Invoice;

use App\Rules\CheckInvoiceRule;
use App\Services\WhmcsServices;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;

class CheckInvoiceRequest extends FormRequest
{

    protected WhmcsServices $whmcsServices;
    public function __construct(WhmcsServices $whmcsServices)
    {
        $this->whmcsServices = $whmcsServices;
    }

    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            'invoiceNumber' => ['required', new CheckInvoiceRule($this->whmcsServices)],
            // 'clientEmail' => ['required']
        ];
    }

    public function messages()
    {
        return [
            'invoiceNumber.required' => 'Invoice Number is Required!',
            // 'clientEmail.required' => 'Please enter you email',
     
        ];
    }
}
