<?php

namespace App\Http\Requests\V1\ExpectedExpense;

use Illuminate\Foundation\Http\FormRequest;

class UpdateExpectedExpenseRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'expected_payment_date' => ['sometimes', 'date'],
            'settlement_date' => ['nullable', 'date'],
            'transaction_type' => ['sometimes', 'string', 'in:purchase,advance,suspense,rent,salary,insurance,tax,utilities,other'],
            'amount' => ['sometimes', 'numeric', 'min:0'],
            'client_id' => ['nullable', 'integer', 'exists:clients,id'],
            'client_name' => ['nullable', 'string', 'max:100'],
            'bank_account_id' => ['nullable', 'integer', 'exists:bank_accounts,id'],
            'account_code' => ['nullable', 'string', 'max:50'],
            'payment_status' => ['sometimes', 'string', 'in:pending,partial,paid,overdue'],
            'approval_status' => ['sometimes', 'string', 'in:none,pending,approved,rejected'],
            'description' => ['nullable', 'string', 'max:1000'],
        ];
    }

    public function attributes(): array
    {
        return [
            'expected_payment_date' => '예상 지급일',
            'settlement_date' => '결제일',
            'transaction_type' => '거래유형',
            'amount' => '금액',
            'client_id' => '거래처',
            'client_name' => '거래처명',
            'bank_account_id' => '계좌',
            'account_code' => '계정과목',
            'payment_status' => '지급상태',
            'approval_status' => '결재상태',
            'description' => '적요',
        ];
    }
}
