namespace CSR.Domain.Entities;

public record Role
{
  public int Id { get; private set; }
  public string Name { get; private set; }

  private Role(int id, string name)
  {
    Id = id;
    Name = name;
  }

  internal static Role LoadExisting(int id, string name)
  {
    return new Role(id, name);
  }

  private static Role? _admin = null;
  public static Role Admin
  {
    get
    {
      if (_admin == null)
      {
        _admin = new Role(1, "Admin");
      }
      return _admin!;
    }
  }
  private static Role? _user = null;
  public static Role User
  {
    get
    {
      if (_user == null)
      {
        _user = new Role(2, "User");
      }
      return _user!;
    }
  }
}
