import type { UseCaseOutputPort } from '@core/shared/application';
import type { GetAvatarResult } from '@core/media/application/use-cases/GetAvatarUseCase';
import type { GetAvatarOutputDTO } from '../dtos/GetAvatarOutputDTO';

export type GetAvatarResponseModel = GetAvatarOutputDTO | null;

export class GetAvatarPresenter implements UseCaseOutputPort<GetAvatarResult> {
  private model: GetAvatarResponseModel | null = null;

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

  present(result: GetAvatarResult): void {
    this.model = {
      avatarUrl: result.avatar.mediaUrl,
    };
  }

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

  get responseModel(): GetAvatarResponseModel {
    return this.model ?? null;
  }
}