using Model.Stub;
using System.Xml.Serialization;

namespace Model;

public class Artist
{
    public string Name
    {
        get => name;

        set
        {
            if (value != null && value.Length < Manager.MAX_NAME_LENGTH)
            {
                name = value;
            }
        }
    }

    private string name = Manager.DEFAULT_NAME;

    public Artist(string name)
    {
        Name = name;
    }

    public Artist()
    {

    }

    public override bool Equals(object? obj)
    {
        if(obj == null) return false;
        if(obj.GetType() != typeof(Artist)) return false;
        if(obj is Artist artist && Name == artist.Name) return true;
        else return false;
    }

    public override int GetHashCode()
    {
        return Name.GetHashCode();
    }

    public override string ToString()
    {
        return $"Name : {Name}";
    }
}
