import { ITransactionManager } from "@/core/common/infrastructure/database";
import { LogoutData } from "../../domain";
import { IAuthService } from "../../domain/services";

export class LogoutUseCase {
  constructor(
    private readonly authService: IAuthService,
    private readonly transactionManager: ITransactionManager
  ) {}

  public async execute(logoutData: LogoutData) {
    return await this.transactionManager.complete(async (transaction) => {
      return await this.authService.logoutUser(logoutData, transaction);
    });
  }
}
