33 lines
1018 B
TypeScript
33 lines
1018 B
TypeScript
import { ViewModel } from "../contracts/view-models/ViewModel";
|
|
import { LeagueCreationStatusFormatter } from '../formatters/LeagueCreationStatusFormatter';
|
|
import type { CreateLeagueViewData } from '../view-data/CreateLeagueViewData';
|
|
|
|
/**
|
|
* View Model for Create League Result
|
|
*
|
|
* Represents the result of creating a league in a UI-ready format.
|
|
* Composes Display Objects and transforms ViewData for UI consumption.
|
|
*/
|
|
export class CreateLeagueViewModel extends ViewModel {
|
|
private readonly data: CreateLeagueViewData;
|
|
|
|
constructor(data: CreateLeagueViewData) {
|
|
super();
|
|
this.data = data;
|
|
}
|
|
|
|
get leagueId(): string { return this.data.leagueId; }
|
|
get success(): boolean { return this.data.success; }
|
|
|
|
/** UI-specific: Success message using Display Object */
|
|
get successMessage(): string {
|
|
return LeagueCreationStatusFormatter.statusMessage(this.success);
|
|
}
|
|
|
|
/** UI-specific: Whether league creation was successful */
|
|
get isSuccessful(): boolean {
|
|
return this.success;
|
|
}
|
|
}
|
|
|