using Modules.Library.Domain.Models;

namespace Modules.Library.Domain.Entities.Language;

public class Language : Entity
{
    [Required]
    public string CodeIso2 { get; private set; } = default!;
    [Required]
    public string Name { get; private set; } = default!;
    public Guid? IconId { get; private set; }
    private Language() { }

    public Language(string codeIso2, string name, Guid? iconId, Guid? id = null, bool deleted = false)
    {
        if (id.HasValue) Id = id.Value;
        CodeIso2 = codeIso2;
        Name = name;
        IconId = iconId;
        Deleted = deleted;
    }

    internal void SetName(string name) => Name = name;
    internal void SetIcon(Guid? iconId) => IconId = iconId;
}