<?php
declare(strict_types=1);

namespace WP_AUX\Entities\AuxCF\Fields\Card;

use AuxCF\Entities\Field\Enum\RepeaterFieldLayoutEnum;
use AuxCF\Entities\Field\RepeaterFieldEntity;
use AuxCF\Entities\Settings\Enum\OperatorEnum;
use WP_AUX\Entities\AuxCF\Fields\Section\SectionCardsCtaTypeFieldEntity;
use WP_AUX\Entities\AuxCF\Fields\FeaturedCard\CardsCtaTypeFieldEntity;
use WP_AUX\Enum\CtaTypes\AllCtaNoButtonsTypesEnum;

class CardCtasFieldEntity extends RepeaterFieldEntity
{
  public static string $name = 'card_ctas';
  protected string $label = 'Card CTAs';
  protected RepeaterFieldLayoutEnum $layout = RepeaterFieldLayoutEnum::Row;
  protected int $min = 1;
  protected ?int $max = 3;
  protected string $instructions = 'Select link destination and link text for each CTA.';

  protected array $initFields = [
    CardLinkFieldEntity::class,
  ];

  protected array $initConditionalLogic = [
    [
      [ SectionCardsCtaTypeFieldEntity::class, OperatorEnum::EQUALS, AllCtaNoButtonsTypesEnum::Links ],
      [ CardsCtaTypeFieldEntity::class, OperatorEnum::EQUALS, AllCtaNoButtonsTypesEnum::Links ],
    ]
  ];
}
