import type { LogoutResult } from '@core/identity/application/use-cases/LogoutUseCase';
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';

export interface CommandResultDTO {
  success: boolean;
  message?: string;
}

export class CommandResultPresenter implements UseCaseOutputPort<LogoutResult> {
  private model: CommandResultDTO | null = null;

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

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

  getResponseModel(): CommandResultDTO {
    if (!this.model) {
      throw new Error('Presenter not presented');
    }
    return this.model;
  }

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