/**
 * Convex function path constants
 *
 * Centralizes all string-based function paths used with ConvexHttpClient.
 * Prevents typo bugs across 15+ call sites.
 */

export const CONVEX_PATHS = {
  // Auth queries
  getUserByAnyId: "auth/queries:getUserByAnyId",
  getUserByAppUserId: "auth/queries:getUserByAppUserId",
  getUserByEmail: "auth/queries:getUserByEmail",
  getUserByPhoneNumber: "auth/queries:getUserByPhoneNumber",
  getUserByClerkId: "auth/queries:getUserByClerkId",
  getUserByStripeCustomerId: "auth/queries:getUserByStripeCustomerId",
  getUser: "auth/queries:getUser",
  getSessionByToken: "auth/queries:getSessionByToken",

  // Billing queries
  getSubscriptionByAnyId: "billing/queries:getSubscriptionByAnyId",
  getSubscriptionByCustomerId: "billing/queries:getSubscriptionByCustomerId",
  getPaymentByStripePaymentIntentId:
    "billing/queries:getPaymentByStripePaymentIntentId",
  getRefundById: "billing/queries:getRefundById",

  // Organization queries
  getOrganizationByConnectAccountId:
    "organizations/queries:getOrganizationByConnectAccountId",
  getOrganizationByAnyId: "organizations/queries:getOrganizationByAnyId",

  // Auth mutations
  // NOTE: internalMutation functions cannot be called via ConvexHttpClient.
  // Use initializeClerkUser (public mutation) for Clerk signup flows.
  initializeClerkUser: "auth/mutations:initializeClerkUser", // public mutation — creates user + org + membership
  createUserNoAuth: "auth/mutations:createUserNoAuth", // internalMutation
  updateUserNoAuth: "auth/mutations:updateUserNoAuth", // internalMutation
  deleteUserNoAuth: "auth/mutations:deleteUserNoAuth", // internalMutation
  setOnboardingCompleteNoAuth: "auth/mutations:setOnboardingCompleteNoAuth", // internalMutation
  createSessionNoAuth: "auth/mutations:createSessionNoAuth", // internalMutation
  deleteSessionNoAuth: "auth/mutations:deleteSessionNoAuth",
  revokeOtherSessionsNoAuth: "auth/mutations:revokeOtherSessionsNoAuth",
  touchSessionByToken: "auth/mutations:touchSessionByToken",
  markLoginHistoryLoggedOut: "auth/mutations:markLoginHistoryLoggedOut",

  // Organization mutations
  createOrganizationInvitation: "organizations/mutations:createInvitation",
  updateOrganizationNoAuth: "organizations/mutations:updateOrganizationNoAuth",

  // Billing mutations
  upsertSubscriptionByStripeId:
    "billing/mutations:upsertSubscriptionByStripeId",
  recordBillingEventIfMissing: "billing/mutations:recordBillingEventIfMissing",
  upsertPayment: "billing/mutations:upsertPayment",
  upsertRefund: "billing/mutations:upsertRefund",
  // Customer queries
  getCustomers: "customers/queries:getCustomers",
  getCustomerById: "customers/queries:getCustomerById",

  // Customer mutations
  createCustomer: "customers/mutations:createCustomer",
  updateCustomer: "customers/mutations:updateCustomer",
  deleteCustomer: "customers/mutations:deleteCustomer",
} as const;
