<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class StoreTaskRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            // Complete the validation rules
            'title' => ['required', 'string', 'max:255'],
            'description' => ['nullable', 'string'],
            'progress' => ['required', 'integer', 'min:0', 'max:2'],
            'priority' => ['required', 'integer', 'min:0', 'max:3'],
            'start_date' => ['nullable', 'date'],
            'due_date' => ['nullable', 'date'],
            'completed_date' => ['nullable', 'date'],
            'bucket_id' => ['required', 'integer', 'exists:buckets,id'],
            'user_id' => ['nullable', 'integer', 'exists:users,id'],
        ];
    }
}
