<?php

declare(strict_types=1);

namespace App\Http\Requests\Producer;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'first_name' => ['nullable', 'string', 'max:120'],
            'last_name' => ['nullable', 'string', 'max:120'],
            'avatar' => ['nullable', 'string', 'max:500'],
            'national_code' => ['nullable', 'string', 'max:20'],
            'national_cart_image' => ['nullable', 'string', 'max:500'],
            'cellphone' => ['nullable', 'string', 'max:20'],
            'email' => ['nullable', 'email', 'max:255'],
            'phone' => ['nullable', 'string', 'max:20'],
            'dob' => ['nullable', 'date'],
            'address' => ['nullable', 'string'],
            'province_id' => ['nullable', 'integer', 'exists:provinces,id'],
            'county_id' => ['nullable', 'integer', 'exists:counties,id'],
            'postal_code' => ['nullable', 'string', 'max:20'],
            'latitude' => ['nullable', 'numeric'],
            'longitude' => ['nullable', 'numeric'],
            'password' => ['nullable', 'string', 'min:6'],

            'brand_name' => ['nullable', 'string', 'max:255'],
            'activity_main_category' => ['required', 'string', 'max:120'],
            'activity_sub_category' => ['nullable', 'string', 'max:120'],
            'activity_product' => ['nullable', 'string', 'max:120'],
            'unit_capacity' => ['nullable', 'integer', 'min:0'],
            'unit_area' => ['nullable', 'numeric', 'min:0'],
            'work_email' => ['nullable', 'email', 'max:255'],
            'work_phone' => ['nullable', 'string', 'max:20'],
            'work_province_id' => ['nullable', 'integer', 'exists:provinces,id'],
            'work_county_id' => ['nullable', 'integer', 'exists:counties,id'],
            'work_address' => ['nullable', 'string'],
            'work_postal_code' => ['nullable', 'string', 'max:20'],
            'work_latitude' => ['nullable', 'numeric'],
            'work_longitude' => ['nullable', 'numeric'],
            'business_license' => ['nullable', 'array'],
            'business_license.*' => ['string', 'max:500'],
            'education_certificates' => ['nullable', 'array'],
            'education_certificates.*' => ['string', 'max:500'],
            'skill_certificates' => ['nullable', 'array'],
            'skill_certificates.*' => ['string', 'max:500'],
            'work_experience' => ['nullable', 'array'],
            'work_experience.*.title' => ['nullable', 'string', 'max:255'],
            'work_experience.*.from' => ['nullable', 'date'],
            'work_experience.*.to' => ['nullable', 'date'],
            'work_experience.*.description' => ['nullable', 'string'],
            'ownership_document' => ['nullable', 'string', 'max:500'],
            'lease_start_date' => ['nullable', 'date'],
            'lease_end_date' => ['nullable', 'date', 'after:lease_start_date'],
            'unit_images' => ['nullable', 'array'],
            'unit_images.*' => ['string', 'max:500'],
            'unit_videos' => ['nullable', 'array'],
            'unit_videos.*' => ['string', 'max:500'],
        ];
    }
}
