52 lines
1.7 KiB
TypeScript
52 lines
1.7 KiB
TypeScript
import { ViewModel } from "../contracts/view-models/ViewModel";
|
|
import { OnboardingStatusFormatter } from '../formatters/OnboardingStatusFormatter';
|
|
import type { CompleteOnboardingViewData } from '../view-data/CompleteOnboardingViewData';
|
|
|
|
/**
|
|
* Complete onboarding view model
|
|
* UI representation of onboarding completion result
|
|
*
|
|
* Composes Display Objects and transforms ViewData for UI consumption.
|
|
*/
|
|
export class CompleteOnboardingViewModel extends ViewModel {
|
|
private readonly data: CompleteOnboardingViewData;
|
|
|
|
constructor(data: CompleteOnboardingViewData) {
|
|
super();
|
|
this.data = data;
|
|
}
|
|
|
|
get success(): boolean { return this.data.success; }
|
|
get driverId(): string | undefined { return this.data.driverId; }
|
|
get errorMessage(): string | undefined { return this.data.errorMessage; }
|
|
|
|
/** UI-specific: Status label using Display Object */
|
|
get statusLabel(): string {
|
|
return OnboardingStatusFormatter.statusLabel(this.success);
|
|
}
|
|
|
|
/** UI-specific: Status variant using Display Object */
|
|
get statusVariant(): string {
|
|
return OnboardingStatusFormatter.statusVariant(this.success);
|
|
}
|
|
|
|
/** UI-specific: Status icon using Display Object */
|
|
get statusIcon(): string {
|
|
return OnboardingStatusFormatter.statusIcon(this.success);
|
|
}
|
|
|
|
/** UI-specific: Status message using Display Object */
|
|
get statusMessage(): string {
|
|
return OnboardingStatusFormatter.statusMessage(this.success, this.errorMessage);
|
|
}
|
|
|
|
/** UI-specific: Whether onboarding was successful */
|
|
get isSuccessful(): boolean {
|
|
return this.success;
|
|
}
|
|
|
|
/** UI-specific: Whether there was an error */
|
|
get hasError(): boolean {
|
|
return !!this.errorMessage;
|
|
}
|
|
} |