<?php

namespace App\Domain\Event\Enums;

enum FormFieldType: string
{
    case Text = 'text';
    case Textarea = 'textarea';
    case Number = 'number';
    case Email = 'email';
    case Phone = 'phone';
    case Date = 'date';
    case Select = 'select';
    case MultiSelect = 'multi_select';
    case Checkbox = 'checkbox';
    case FileUpload = 'file_upload';

    public function label(): string
    {
        return match ($this) {
            self::Text => 'نص قصير',
            self::Textarea => 'نص طويل',
            self::Number => 'رقم',
            self::Email => 'بريد إلكتروني',
            self::Phone => 'هاتف',
            self::Date => 'تاريخ',
            self::Select => 'قائمة اختيار',
            self::MultiSelect => 'اختيار متعدد',
            self::Checkbox => 'خانة اختيار',
            self::FileUpload => 'رفع ملف',
        };
    }

    public function icon(): string
    {
        return match ($this) {
            self::Text => 'bars-3-bottom-left',
            self::Textarea => 'document-text',
            self::Number => 'hashtag',
            self::Email => 'at-symbol',
            self::Phone => 'phone',
            self::Date => 'calendar',
            self::Select => 'chevron-down',
            self::MultiSelect => 'list-bullet',
            self::Checkbox => 'check-circle',
            self::FileUpload => 'arrow-up-tray',
        };
    }

    public function baseValidation(): string
    {
        return match ($this) {
            self::Text => 'string|max:500',
            self::Textarea => 'string|max:5000',
            self::Number => 'numeric',
            self::Email => 'email|max:255',
            self::Phone => 'string|max:20',
            self::Date => 'date',
            self::Select => 'string',
            self::MultiSelect => 'array',
            self::Checkbox => 'boolean',
            self::FileUpload => 'file|max:5120',
        };
    }
}
