30 lines
805 B
TypeScript
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;
|
|
}
|
|
} |