using System; namespace DragNDrop.Model; public class Nounours : IEquatable { public int Id { get; private init; } public string Name { get; private set; } public string Image => $"{Name.ToLower().Replace(" ", "_")}.png"; public Nounours(int id, string name) { Id = id; Name = name; } public Nounours(string name) : this(0, name) {} public override string ToString() => $"{Name}"; public bool Equals(Nounours? other) => Id == other?.Id; public override bool Equals(object? obj) { if(ReferenceEquals(obj, null)) return false; if(ReferenceEquals(obj, this)) return true; if(!GetType().Equals(obj.GetType())) return false; return Equals(obj as Nounours); } public override int GetHashCode() => Id.GetHashCode(); }