<?php
declare(strict_types=1);

namespace WP_AUX\Enum;

use WP_AUX\Interfaces\OptionsEnumInterface;
use WP_AUX\Traits\EnumTraits;

enum AlertTypeEnum: string implements OptionsEnumInterface
{
  use EnumTraits;

  case Information = 'info';
  case Success = 'success';
  case Error = 'error';
  case Warning = 'warning';

  public const SETTING_LABEL = 'Sidebar Component';

  public function label(): string
  {
    return match($this) {
      self::Information => 'Information',
      self::Success => 'Success',
      self::Error => 'Error',
      self::Warning => 'Warning',
    };
  }

  public function string(): ?string
  {
    return match ($this) {
      self::Information => 'info',
      self::Success => 'success',
      self::Error => 'error',
      self::Warning => 'warning',
      default => null
    };
  }

  public function icon(): ?IconsEnum
  {
    return match ($this) {
      self::Information => IconsEnum::CIRCLE_OUTLINE_INFO,
      self::Success => IconsEnum::CIRCLE_OUTLINE_CHECK,
      self::Error => IconsEnum::CIRCLE_OUTLINE_XMARK,
      self::Warning => IconsEnum::TRIANGLE_OUTLINE_EXCLAMATION,
      default => null
    };
  }
}
