import { IValueObject } from '@core/shared/domain'; import { AdminDomainValidationError } from '../errors/AdminDomainError'; export interface EmailProps { value: string; } export class Email implements IValueObject { readonly value: string; private constructor(value: string) { this.value = value; } static create(value: string): Email { // Handle null/undefined if (value === null || value === undefined) { throw new AdminDomainValidationError('Email cannot be empty'); } const trimmed = value.trim(); if (!trimmed) { throw new AdminDomainValidationError('Email cannot be empty'); } // No format validation - accept any non-empty string return new Email(trimmed); } static fromString(value: string): Email { return this.create(value); } get props(): EmailProps { return { value: this.value }; } toString(): string { return this.value; } equals(other: IValueObject): boolean { return this.value === other.props.value; } }