import type { CommonDomainErrorKind, DomainError } from '@core/shared/errors/DomainError';

export abstract class IdentityDomainError extends Error implements DomainError<CommonDomainErrorKind> {
  readonly type = 'domain' as const;
  readonly context = 'identity-domain';
  abstract readonly kind: CommonDomainErrorKind;

  constructor(message: string) {
    super(message);
    Object.setPrototypeOf(this, new.target.prototype);
  }
}

export class IdentityDomainValidationError
  extends IdentityDomainError
  implements DomainError<'validation'>
{
  readonly kind = 'validation' as const;

  constructor(message: string) {
    super(message);
  }
}

export class IdentityDomainInvariantError
  extends IdentityDomainError
  implements DomainError<'invariant'>
{
  readonly kind = 'invariant' as const;

  constructor(message: string) {
    super(message);
  }
}