31 lines
1012 B
TypeScript
31 lines
1012 B
TypeScript
import type { CreateTeamViewData } from '../view-data/CreateTeamViewData';
|
|
import { ViewModel } from "../contracts/view-models/ViewModel";
|
|
import { TeamCreationStatusDisplay } from '../display-objects/TeamCreationStatusDisplay';
|
|
|
|
/**
|
|
* View Model for Create Team Result
|
|
*
|
|
* Represents the result of creating a team in a UI-ready format.
|
|
* Composes Display Objects and transforms ViewData for UI consumption.
|
|
*/
|
|
export class CreateTeamViewModel extends ViewModel {
|
|
readonly teamId: string;
|
|
readonly success: boolean;
|
|
|
|
// UI-specific derived fields (primitive outputs only)
|
|
readonly successMessage: string;
|
|
|
|
constructor(viewData: CreateTeamViewData) {
|
|
super();
|
|
this.teamId = viewData.teamId;
|
|
this.success = viewData.success;
|
|
|
|
// Derive UI-specific fields using Display Object
|
|
this.successMessage = TeamCreationStatusDisplay.statusMessage(this.success);
|
|
}
|
|
|
|
/** UI-specific: Whether team creation was successful */
|
|
get isSuccessful(): boolean {
|
|
return this.success;
|
|
}
|
|
} |