<?php

namespace App\Http\Requests\Admin;

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

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

    public function rules(): array
    {
        return [
            'name' => ['required', 'string', 'max:255'],
            'address' => ['nullable', 'string', 'max:255'],
            'contact_person' => ['nullable', 'string', 'max:255'],
            'contact_phone' => ['nullable', 'string', 'max:50'],
            'contact_email' => ['nullable', 'email', 'max:255'],
            'country_id' => ['nullable', 'exists:countries,id'],
            'currency_id' => ['nullable', 'exists:currencies,id'],
            'distance_unit' => ['required', Rule::in(['km', 'mi'])],
            'timezone' => ['required', 'string', 'max:64'],
            'latitude' => ['nullable', 'numeric', 'between:-90,90'],
            'longitude' => ['nullable', 'numeric', 'between:-180,180'],
            'sms_provider' => ['nullable', 'string', 'max:255'],
            'sms_api_key' => ['nullable', 'string', 'max:1000'],
            'sms_sender_id' => ['nullable', 'string', 'max:20'],
            'sms_template' => ['nullable', 'string', 'max:500'],
            'whatsapp_sender_id' => ['nullable', 'string', 'max:30'],
            'twiml_app_sid' => ['nullable', 'string', 'max:255'],
            'stripe_publishable_key' => ['nullable', 'string', 'max:255'],
            'stripe_secret_key' => ['nullable', 'string', 'max:1000'],
            'stripe_webhook_secret' => ['nullable', 'string', 'max:255'],
            'webhook_url' => ['nullable', 'url', 'max:255'],
            'regenerate_webhook_secret' => ['nullable', 'boolean'],
        ];
    }
}
