<?php

namespace App\Domains\Purchase\Requests;

use Illuminate\Foundation\Http\FormRequest;

class StorePurchaseRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user() !== null;
    }

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return [
            'cart_id' => ['required', 'integer', 'exists:carritos,id'],
            'dni' => ['required', 'string'],
            'telefono' => ['required', 'string'],
            'nombre_apellido' => ['required', 'string'],
            'email' => ['required', 'string', 'email'],
        ];
    }
}
