<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class ReportRequest extends FormRequest
{
    public function authorize(): bool
    {
        return (bool) $this->user()?->business_id;
    }

    public function rules(): array
    {
        return [
            'type' => ['nullable', Rule::in(['daily', 'weekly', 'monthly', 'annual', 'outstanding', 'income', 'group', 'member'])],
            'date' => ['nullable', 'date'],
            'group_id' => ['nullable', 'uuid'],
            'member_id' => ['nullable', 'uuid'],
            'format' => ['nullable', Rule::in(['pdf', 'xls'])],
        ];
    }
}
