import { DomainError } from '@/shared/exceptions/domain.exception';

export class WalletId {
  private readonly _value: bigint;

  private constructor(value: bigint) {
    this._value = value;
  }

  static create(value: bigint | number | string): WalletId {
    const bigintValue = typeof value === 'bigint' ? value : BigInt(value);
    if (bigintValue < 0) {
      throw new DomainError('WalletId cannot be negative');
    }
    return new WalletId(bigintValue);
  }

  get value(): bigint {
    return this._value;
  }

  equals(other: WalletId): boolean {
    return this._value === other._value;
  }

  toString(): string {
    return this._value.toString();
  }
}
