33 lines
934 B
TypeScript
33 lines
934 B
TypeScript
import type { RecordEngagementOutputDTO } from '@/lib/types/generated/RecordEngagementOutputDTO';
|
|
|
|
/**
|
|
* Record engagement output view model
|
|
* Represents the result of recording an engagement event for UI consumption
|
|
*/
|
|
import { ViewModel } from "../contracts/view-models/ViewModel";
|
|
|
|
export class RecordEngagementOutputViewModel extends ViewModel {
|
|
eventId: string;
|
|
engagementWeight: number;
|
|
|
|
constructor(dto: RecordEngagementOutputDTO) {
|
|
this.eventId = dto.eventId;
|
|
this.engagementWeight = dto.engagementWeight;
|
|
}
|
|
|
|
/** UI-specific: Formatted event ID for display */
|
|
get displayEventId(): string {
|
|
return `Event: ${this.eventId}`;
|
|
}
|
|
|
|
/** UI-specific: Formatted engagement weight */
|
|
get displayEngagementWeight(): string {
|
|
return `${this.engagementWeight.toFixed(2)}`;
|
|
}
|
|
|
|
/** UI-specific: Is high engagement */
|
|
get isHighEngagement(): boolean {
|
|
return this.engagementWeight > 1.0;
|
|
}
|
|
}
|