<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;

class DealBuilderPickupRequest extends FormRequest
{
    public function authorize(): bool
    {
        return Auth::check();
    }

    public function rules(): array
    {
        return [
            'active' => [
                'present',
                'boolean',
            ],
            'max_concurrent_pickups' => [
                'required',
                'numeric',
                'min:1',
            ],
            'time_windows' => [
                'array',
            ],
            'time_windows.*' => 'date_format:H:i',
            'mondays' => [
                'boolean',
            ],
            'tuesdays' => [
                'boolean',
            ],
            'wednesdays' => [
                'boolean',
            ],
            'thursdays' => [
                'boolean',
            ],
            'fridays' => [
                'boolean',
            ],
            'saturdays' => [
                'boolean',
            ],
            'sundays' => [
                'boolean',
            ],
            'min_days_in_future' => [
                'numeric',
                'min:0',
            ],
            'max_days_in_future' => [
                'numeric',
                'min:0',
            ],
            'holidays' => 'array',
            'holidays.*' => 'date_format:Y-m-d',
        ];
    }
}
