<?php

namespace App\Domain\Website\Blocks;

/**
 * The input controls the builder UI knows how to render.
 * Adding a control here + a case in the field-renderer Blade is all that is
 * required to give every block type a new kind of input.
 */
enum FieldType: string
{
    case Text = 'text';
    case Textarea = 'textarea';
    case RichText = 'rich_text';
    case Number = 'number';
    case Toggle = 'toggle';
    case Select = 'select';
    case Radio = 'radio';
    case Color = 'color';
    case Image = 'image';
    case Gallery = 'gallery';
    case Video = 'video';
    case Icon = 'icon';
    case Link = 'link';
    case Date = 'date';
    case Alignment = 'alignment';
    case Spacing = 'spacing';
    case Repeater = 'repeater';
    case DataSource = 'data_source';
    case Code = 'code';
    case Map = 'map';

    /** Bilingual controls render two inputs (ar + en) and store {"ar":..,"en":..}. */
    public function isTranslatable(): bool
    {
        return in_array($this, [self::Text, self::Textarea, self::RichText], true);
    }
}
