/**
 * InvitationToken Repository Port
 *
 * Defines the interface for InvitationToken persistence operations.
 * This is a secondary port (output port) in hexagonal architecture.
 */

import { InvitationToken } from '../../entities/invitation-token.entity';

export const INVITATION_TOKEN_REPOSITORY = 'InvitationTokenRepository';

export interface InvitationTokenRepository {
  /**
   * Save an invitation token entity
   */
  save(invitationToken: InvitationToken): Promise<InvitationToken>;

  /**
   * Find invitation token by token string
   */
  findByToken(token: string): Promise<InvitationToken | null>;

  /**
   * Find invitation token by email (only non-used, non-expired)
   */
  findActiveByEmail(email: string): Promise<InvitationToken | null>;

  /**
   * Find all invitation tokens by organization
   */
  findByOrganization(organizationId: string): Promise<InvitationToken[]>;

  /**
   * Delete expired invitation tokens
   */
  deleteExpired(): Promise<number>;

  /**
   * Delete an invitation by id
   */
  deleteById(id: string): Promise<void>;

  /**
   * Update an invitation token
   */
  update(invitationToken: InvitationToken): Promise<InvitationToken>;
}
