<?php

namespace App\Http\Requests\V1\Payment;

use App\Models\Tenants\Payment;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

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

    public function rules(): array
    {
        return [
            'subscription_id' => ['required', 'integer', 'exists:subscriptions,id'],
            'amount' => ['required', 'numeric', 'min:0'],
            'payment_method' => ['required', 'string', Rule::in(Payment::PAYMENT_METHODS)],
            'transaction_id' => ['nullable', 'string', 'max:100'],
            'memo' => ['nullable', 'string', 'max:500'],
            'auto_complete' => ['nullable', 'boolean'],
        ];
    }
}
