import { z } from "zod";
import type { IAuthenticationService } from "../services/authentication.service.interface";

// ── Input ────────────────────────────────────────────────────────────────
export const signOutInputSchema = z.object({ sessionId: z.string() }).strict();
export type SignOutInput = z.infer<typeof signOutInputSchema>;

// No xOutputSchema — use case returns void.

// ── Use case ─────────────────────────────────────────────────────────────
export type ISignOutUseCase = ReturnType<typeof signOutUseCase>;

export const signOutUseCase =
  (authenticationService: IAuthenticationService) =>
  async (input: SignOutInput): Promise<void> => {
    await authenticationService.invalidateSession(input.sessionId);
  };
