<?php

declare(strict_types=1);

namespace Maestro\Core\Modules\Customers\Http\Requests\Address;

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

class UpdateAddressRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return [
            'type' => ['sometimes', 'required', Rule::in(['billing', 'shipping', 'other'])],
            'street' => ['sometimes', 'required', 'string', 'max:255'],
            'house_number' => ['sometimes', 'required', 'string', 'max:255'],
            'house_number_addition' => ['nullable', 'string', 'max:255'],
            'postal_code' => ['sometimes', 'required', 'string', 'max:32'],
            'city' => ['sometimes', 'required', 'string', 'max:255'],
            'country' => ['sometimes', 'required', 'string', 'max:255'],
            'is_primary' => ['boolean'],
        ];
    }
}
