namespace Monitoring.Core.Domain.AlarmCommentPrimitives;

public sealed class AlarmResetCommentLanguage
{
	private AlarmResetCommentLanguage(string value)
	{
		Value = value;
	}

	public string Value { get; }
	public const int MaxLength = 2;
	public const int MinLength = 2;

	public static AlarmResetCommentLanguage Create(string value)
	{
		if (string.IsNullOrEmpty(value))
		{
			throw new ArgumentException("Значение не может быть пустым.", nameof(value));
		}

		if (value.Length is < MinLength or > MaxLength)
		{
			throw new ArgumentException($"Значение должно быть длинной от {MinLength} до {MaxLength} символов.", nameof(value));
		}

		return new AlarmResetCommentLanguage(value);
	}

	public static implicit operator string(AlarmResetCommentLanguage alarmResetCommentLanguage)
	{
		return alarmResetCommentLanguage.Value;
	}
}
