import { RacingDomainValidationError } from '../errors/RacingDomainError';

export type MembershipRoleValue = 'owner' | 'admin' | 'steward' | 'member';

export class MembershipRole {
  private constructor(private readonly value: MembershipRoleValue) {}

  static create(value: MembershipRoleValue): MembershipRole {
    if (!value) {
      throw new RacingDomainValidationError('Membership role is required');
    }
    return new MembershipRole(value);
  }

  toString(): MembershipRoleValue {
    return this.value;
  }

  equals(other: MembershipRole): boolean {
    return this.value === other.value;
  }
}