wip
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import type { IValueObject } from '@gridpilot/shared/domain';
|
||||
|
||||
export interface AnalyticsSessionIdProps {
|
||||
value: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Value Object: AnalyticsSessionId
|
||||
*
|
||||
* Represents an analytics session identifier within the analytics bounded context.
|
||||
*/
|
||||
export class AnalyticsSessionId implements IValueObject<AnalyticsSessionIdProps> {
|
||||
public readonly props: AnalyticsSessionIdProps;
|
||||
|
||||
private constructor(value: string) {
|
||||
this.props = { value };
|
||||
}
|
||||
|
||||
static create(raw: string): AnalyticsSessionId {
|
||||
const value = raw.trim();
|
||||
|
||||
if (!value) {
|
||||
throw new Error('AnalyticsSessionId must be a non-empty string');
|
||||
}
|
||||
|
||||
return new AnalyticsSessionId(value);
|
||||
}
|
||||
|
||||
get value(): string {
|
||||
return this.props.value;
|
||||
}
|
||||
|
||||
equals(other: IValueObject<AnalyticsSessionIdProps>): boolean {
|
||||
return this.props.value === other.props.value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user