import type { UseCaseOutputPort } from '@core/shared/application';
import type { DeleteMediaResult } from '@core/media/application/use-cases/DeleteMediaUseCase';
import type { DeleteMediaOutputDTO } from '../dtos/DeleteMediaOutputDTO';

type DeleteMediaResponseModel = DeleteMediaOutputDTO;

export class DeleteMediaPresenter implements UseCaseOutputPort<DeleteMediaResult> {
  private model: DeleteMediaResponseModel | null = null;

  reset(): void {
    this.model = null;
  }

  present(result: DeleteMediaResult): void {
    this.model = {
      success: result.deleted,
    };
  }

  getResponseModel(): DeleteMediaResponseModel | null {
    return this.model;
  }

  get responseModel(): DeleteMediaResponseModel {
    if (!this.model) throw new Error('Presenter not presented');
    return this.model;
  }
}
