import type { ActivityAction, EntityType, Prisma } from "@prisma/client";

/**
 * Interface for creating a new activity log entry
 * workspaceId is optional - allows logging events without workspace context
 */
export interface CreateActivityLogInput {
  workspaceId?: string | null;
  userId: string;
  action: ActivityAction;
  entityType: EntityType;
  entityId: string;
  details?: Prisma.JsonValue;
  ipAddress?: string | undefined;
  userAgent?: string | undefined;
}

/**
 * Interface for activity log query filters
 */
export interface ActivityLogFilters {
  workspaceId: string;
  userId?: string;
  action?: ActivityAction;
  entityType?: EntityType;
  entityId?: string;
  startDate?: Date;
  endDate?: Date;
}

/**
 * Type for activity log result with user info
 * Uses Prisma's generated type for type safety
 */
export type ActivityLogResult = Prisma.ActivityLogGetPayload<{
  include: {
    user: {
      select: {
        id: true;
        name: true;
        email: true;
      };
    };
  };
}>;

/**
 * Interface for paginated activity log results
 */
export interface PaginatedActivityLogs {
  data: ActivityLogResult[];
  meta: {
    total: number;
    page: number;
    limit: number;
    totalPages: number;
  };
}
