<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\Entity;

{% apply sort_namespaces %}
use Drupal\Core\Config\Entity\ConfigEntityBase;
use Drupal\Core\Entity\Attribute\ConfigEntityType;
use Drupal\Core\Entity\EntityDeleteForm;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\{{ machine_name }}\{{ class_prefix }}Interface;
use Drupal\{{ machine_name }}\{{ class_prefix }}ListBuilder;
use Drupal\{{ machine_name }}\Form\{{ class_prefix }}Form;
{% endapply %}

/**
 * Defines the {{ entity_type_label|lower }} entity type.
 */
#[ConfigEntityType(
  id: '{{ entity_type_id }}',
  label: new TranslatableMarkup('{{ entity_type_label }}'),
  label_collection: new TranslatableMarkup('{{ entity_type_label|pluralize }}'),
  label_singular: new TranslatableMarkup('{{ entity_type_label|lower }}'),
  label_plural: new TranslatableMarkup('{{ entity_type_label|pluralize|lower }}'),
  config_prefix: '{{ entity_type_id }}',
  entity_keys: [
    'id' => 'id',
    'label' => 'label',
    'uuid' => 'uuid',
  ],
  handlers: [
    'list_builder' => {{ class_prefix }}ListBuilder::class,
    'form' => [
      'add' => {{ class_prefix }}Form::class,
      'edit' => {{ class_prefix }}Form::class,
      'delete' => EntityDeleteForm::class,
    ],
  ],
  links: [
    'collection' => '/admin/structure/{{ entity_type_id|u2h }}',
    'add-form' => '/admin/structure/{{ entity_type_id|u2h }}/add',
    'edit-form' => '/admin/structure/{{ entity_type_id|u2h }}/{{ '{' }}{{ entity_type_id }}{{ '}' }}',
    'delete-form' => '/admin/structure/{{ entity_type_id|u2h }}/{{ '{' }}{{ entity_type_id }}{{ '}' }}/delete',
  ],
  admin_permission: 'administer {{ entity_type_id }}',
  label_count: [
    'singular' => '@count {{ entity_type_label|lower }}',
    'plural' => '@count {{ entity_type_label|pluralize|lower }}',
  ],
  config_export: [
    'id',
    'label',
    'description',
  ],
)]
final class {{ class_prefix }} extends ConfigEntityBase implements {{ class_prefix }}Interface {

  /**
   * The example ID.
   */
  protected string $id;

  /**
   * The example label.
   */
  protected string $label;

  /**
   * The example description.
   */
  protected string $description;

}
