<?php

namespace App\Http\Requests\V1\Subscription;

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

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

    public function rules(): array
    {
        return [
            'plan_id' => ['required', 'integer', 'exists:plans,id'],
            'started_at' => ['nullable', 'date'],
            'payment_method' => ['nullable', 'string', Rule::in(Payment::PAYMENT_METHODS)],
            'transaction_id' => ['nullable', 'string', 'max:100'],
            'auto_complete' => ['nullable', 'boolean'],
        ];
    }
}
