<?php
declare(strict_types=1);

namespace AuxCF\Entities\Field;

use AuxCF\Entities\Field\Enum\FieldTypeEnum;
use AuxCF\Entities\Field\Enum\TabFieldPlacementEnum;
use AuxCF\Entities\FieldEntity;

class TabFieldEntity extends FieldEntity
{
  protected FieldTypeEnum $type = FieldTypeEnum::Tab;

  protected TabFieldPlacementEnum $placement = TabFieldPlacementEnum::DEFAULT;
  protected int $endpoint = 0;
  protected int $selected = 0;

  public function setPlacement(string|TabFieldPlacementEnum $placement): self
  {
    $this->setEnumProperty(TabFieldPlacementEnum::class, $placement, 'placement');
    return $this;
  }

  public function getFieldArray(): array
  {
    $array = [
      'placement' => $this->placement->value,
      'endpoint' => $this->endpoint,
      'selected' => $this->selected,
    ];

    return $array;
  }
}
