import type { ValueObject } from '@core/shared/domain/ValueObject'; import { NotificationDomainError } from '../errors/NotificationDomainError'; export interface NotificationIdProps { value: string; } /** * Value Object: NotificationId * * Encapsulates the unique identifier for a notification and * enforces basic invariants (non-empty trimmed string). */ export class NotificationId implements ValueObject { public readonly props: NotificationIdProps; private constructor(value: string) { this.props = { value }; } /** * Factory with validation. * - Trims input. * - Requires a non-empty value. */ static create(raw: string): NotificationId { const value = raw.trim(); if (!value) { throw new NotificationDomainError('Notification ID must be a non-empty string', 'validation'); } return new NotificationId(value); } get value(): string { return this.props.value; } equals(other: ValueObject): boolean { return this.props.value === other.props.value; } }