35 lines
1023 B
TypeScript
35 lines
1023 B
TypeScript
import { RequestAvatarGenerationOutputDTO } from '../types/generated/RequestAvatarGenerationOutputDTO';
|
|
|
|
/**
|
|
* Request Avatar Generation View Model
|
|
*
|
|
* Represents the result of an avatar generation request
|
|
*/
|
|
export class RequestAvatarGenerationViewModel {
|
|
success: boolean;
|
|
requestId?: string;
|
|
avatarUrls?: string[];
|
|
errorMessage?: string;
|
|
|
|
constructor(dto: RequestAvatarGenerationOutputDTO) {
|
|
this.success = dto.success;
|
|
if (dto.requestId !== undefined) this.requestId = dto.requestId;
|
|
if (dto.avatarUrls !== undefined) this.avatarUrls = dto.avatarUrls;
|
|
if (dto.errorMessage !== undefined) this.errorMessage = dto.errorMessage;
|
|
}
|
|
|
|
/** UI-specific: Whether generation was successful */
|
|
get isSuccessful(): boolean {
|
|
return this.success;
|
|
}
|
|
|
|
/** UI-specific: Whether there was an error */
|
|
get hasError(): boolean {
|
|
return !!this.errorMessage;
|
|
}
|
|
|
|
/** UI-specific: Get first avatar URL */
|
|
get firstAvatarUrl(): string | undefined {
|
|
return this.avatarUrls?.[0];
|
|
}
|
|
} |