<?php
declare(strict_types=1);

namespace AuxCF\Entities\Field;

use AuxCF\Entities\Field\Enum\FieldTypeEnum;
use AuxCF\Entities\Field\Traits\UiSwitchTraits;
use AuxCF\Entities\FieldEntity;
use AuxCF\Entities\Settings\Enum\IntSwitchEnum;

class TrueFalseFieldEntity extends FieldEntity
{
  use UiSwitchTraits;

  protected static array $arrayPropertiesMethods = [
    'getUiArray',
  ];

  protected FieldTypeEnum $type = FieldTypeEnum::TrueFalse;
  protected mixed $defaultValue = IntSwitchEnum::Off;

  protected string $message = '';
  protected string $uiOnText = '';
  protected string $uiOffText = '';

  public function setMessage(string $message): self
  {
    $this->message = $message;
    return $this;
  }

  public function setUiOnText(string $uiOnText): self
  {
    $this->uiOnText = $uiOnText;
    return $this;
  }

  public function setUiOffText(string $uiOffText): self
  {
    $this->uiOffText = $uiOffText;
    return $this;
  }

  public function getFieldArray(): array
  {
    $array = [
      'message' => $this->message,
      'ui_on_text' => $this->uiOnText,
      'ui_off_text' => $this->uiOffText,
    ];

    return $array;
  }
}
