<?php
declare(strict_types=1);

namespace WP_AUX\Entities\AuxCF\Fields\CuratedCollection;

use AuxCF\Entities\Field\Enum\RepeaterFieldLayoutEnum;
use AuxCF\Entities\Field\GroupFieldEntity;
use WP_AUX\Services\AuxCF\BlocksService;

class CuratedCollectionSecondaryFieldEntity extends GroupFieldEntity
{
  public static string $name = 'curated_collection_secondary';
  public static string $nickname = 'secondary';

  protected string $label = 'Secondary Posts';
  protected RepeaterFieldLayoutEnum $layout = RepeaterFieldLayoutEnum::Block;

  protected array $initFields = [
    CuratedCollectionSecondaryPostsFieldEntity::class,
    CuratedCollectionSecondaryBackfillFieldEntity::class,
  ];

  /**
   * After the group's fields are initialized, add conditions to the group based on the number of sets expected
   *
   * Specify the number of sets expected for a variation by adding "Curated Sections: {number}"
   * to the file header comments of that variation file.
   *
   * @since 1.0.0
   */
  protected function afterInitFields(): void
  {
    BlocksService::addVariationsSectionsConditionalLogic(
      'aux_curated_collection',
      2,
      $this
    );
  }
}
