Files
gridpilot.gg/apps/website/lib/view-models/DeleteMediaViewModel.ts
2026-01-23 15:30:23 +01:00

30 lines
805 B
TypeScript

import { ViewModel } from '../contracts/view-models/ViewModel';
import type { DeleteMediaViewData } from '../view-data/DeleteMediaViewData';
/**
* Delete Media View Model
*
* Represents the result of a media deletion operation
* Composes ViewData for UI consumption.
*/
export class DeleteMediaViewModel extends ViewModel {
private readonly data: DeleteMediaViewData;
constructor(data: DeleteMediaViewData) {
super();
this.data = data;
}
get success(): boolean { return this.data.success; }
get error(): string | undefined { return this.data.error; }
/** UI-specific: Whether the deletion was successful */
get isSuccessful(): boolean {
return this.success;
}
/** UI-specific: Whether there was an error */
get hasError(): boolean {
return !!this.error;
}
}