import type { Account } from "next-auth";
import type { TOrganization } from "@formbricks/types/organizations";
import type { TUser } from "@formbricks/types/user";

// Mock user data
export const mockUser: TUser = {
  id: "user-123",
  email: "test@example.com",
  name: "Test User",
  notificationSettings: {
    alert: {},

    unsubscribedOrganizationIds: [],
  },
  emailVerified: new Date(),
  twoFactorEnabled: false,
  identityProvider: "google",
  locale: "en-US",
  createdAt: new Date(),
  updatedAt: new Date(),
  lastLoginAt: new Date(),
  isActive: true,
};

// Mock account data
export const mockAccount: Account = {
  provider: "google",
  type: "oauth",
  providerAccountId: "provider-123",
};

// Mock OpenID account
export const mockOpenIdAccount: Account = {
  ...mockAccount,
  provider: "openid",
};

// Mock SAML account
export const mockSamlAccount: Account = {
  ...mockAccount,
  provider: "saml",
};

// Mock organization data
export const mockOrganization: TOrganization = {
  id: "org-123",
  name: "Test Organization",
  isAISmartToolsEnabled: false,
  isAIDataAnalysisEnabled: false,
  whitelabel: {
    logoUrl: null,
    faviconUrl: null,
  },
  billing: {
    stripeCustomerId: null,
    limits: { monthly: { responses: null }, projects: null },
    usageCycleAnchor: new Date(),
  },
  createdAt: new Date(),
  updatedAt: new Date(),
};

// Mock user with OpenID fields
export const mockOpenIdUser = (options?: {
  name?: string;
  given_name?: string;
  family_name?: string;
  preferred_username?: string;
  email?: string;
}): TUser & {
  given_name?: string;
  family_name?: string;
  preferred_username?: string;
} => ({
  ...mockUser,
  name: options?.name || "",
  given_name: options?.given_name,
  family_name: options?.family_name,
  preferred_username: options?.preferred_username,
  email: options?.email || mockUser.email,
});

// Mock created user response
export const mockCreatedUser = (name: string = mockUser.name): TUser => ({
  ...mockUser,
  name,
  emailVerified: new Date(),
});
