<?php

namespace App\Http\Requests\Admin\Manage;

use App\Enums\Permission;
use App\Enums\PriceType;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class OrderDraftResyncPricesRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()?->can(Permission::ORDERS_CREATE->value) ?? false;
    }

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return [
            'price_type' => ['required', Rule::enum(PriceType::class)],
        ];
    }
}
