export const API_GATE_WAY = "https://apimznstg.aireview.ir";
export const ADMIN_API_PREFIX = "api/v1/admin";

export const REQUEST_TIMEOUT = 30000;

export const API_ROUTES = {
  // Auth APIs
  ADMIN_LOGIN: "auth/login",

  // Draft APIs (non-admin)
  GET_DISCOUNT_DETAIL: (id: string) => `api/v1/discount-drafts/${id}`,
  GET_DRAFT_DETAIL: (id: string) => `api/v1/drafts/${id}`,

  // Admin Users APIs
  GET_ADMIN_USERS: "admin-users",
  GET_ADMIN_USER: (id: string) => `admin-users/${id}`,
  CREATE_ADMIN_USER: "admin-users",
  UPDATE_ADMIN_USER: (id: string) => `admin-users/${id}`,
  DELETE_ADMIN_USER: (id: string) => `admin-users/${id}`,

  // Roles APIs
  GET_ROLES: "roles",
  GET_ROLE: (id: string) => `roles/${id}`,
  CREATE_ROLE: "roles",
  UPDATE_ROLE: (id: string) => `roles/${id}`,
  DELETE_ROLE: (id: string) => `roles/${id}`,
  GET_ROLE_PERMISSIONS: (id: string) => `roles/${id}/permissions`,
  ASSIGN_ROLE_PERMISSION: (roleId: string, permissionId: string) =>
    `roles/${roleId}/permissions/${permissionId}`,
  REMOVE_ROLE_PERMISSION: (roleId: string, permissionId: string) =>
    `roles/${roleId}/permissions/${permissionId}`,

  // Permissions APIs
  GET_PERMISSIONS: "permissions",
  GET_PERMISSION: (id: string) => `permissions/${id}`,
  CREATE_PERMISSION: "permissions",
  UPDATE_PERMISSION: (id: string) => `permissions/${id}`,
  DELETE_PERMISSION: (id: string) => `permissions/${id}`,

  // Product Options APIs (non-admin)
  GET_PRODUCT_OPTIONS: "products/options",
  GET_PRODUCT_OPTION: (id: string) => `products/options/${id}`,
  CREATE_PRODUCT_OPTION: "products/options",
  UPDATE_PRODUCT_OPTION: (id: string) => `products/options/${id}`,
  DELETE_PRODUCT_OPTION: (id: string) => `products/options/${id}`,

  // Categories APIs (non-admin)
  GET_CATEGORIES: "api/v1/products/categories",
  GET_CATEGORY: (id: string) => `api/v1/products/categories/${id}`,
  CREATE_CATEGORY: "api/v1/products/categories",
  UPDATE_CATEGORY: (id: string) => `api/v1/products/categories/${id}`,
  DELETE_CATEGORY: (id: string) => `api/v1/products/categories/${id}`,

  // Products APIs (non-admin)
  GET_PRODUCTS: "api/v1/products",
  GET_PRODUCT: (id: string) => `api/v1/products/${id}`,
  CREATE_PRODUCT: "api/v1/products",
  UPDATE_PRODUCT: (id: string) => `products/${id}`,
  DELETE_PRODUCT: (id: string) => `api/v1/products/${id}`,
  GET_PRODUCT_VARIANTS: (id: string) => `api/v1/products/${id}/variants`,
  CREATE_PRODUCT_VARIANT: (id: string) => `api/v1/products/${id}/variants`,
  UPDATE_PRODUCT_VARIANT: (variantId: string) =>
    `api/v1/products/variants/${variantId}`,
  DELETE_PRODUCT_VARIANT: (variantId: string) =>
    `api/v1/products/variants/${variantId}`,

  // Files APIs
  GET_FILES: "files",
  UPLOAD_FILE: "files",
  GET_FILE: (id: string) => `files/${id}`,
  UPDATE_FILE: (id: string) => `files/${id}`,
  DELETE_FILE: (id: string) => `files/${id}`,
  DOWNLOAD_FILE: (serveKey: string) => `api/v1/files/${serveKey}`, // non-admin

  // Images APIs (non-admin)
  GET_IMAGES: "api/v1/images",
  CREATE_IMAGE: "api/v1/images",
  UPDATE_IMAGE: (imageId: string) => `api/v1/products/images/${imageId}`,
  DELETE_IMAGE: (imageId: string) => `api/v1/products/images/${imageId}`,

  // Landing Hero APIs
  GET_LANDING_HERO: "settings/landing/hero", // non-admin
  UPDATE_LANDING_HERO: "settings/landing/hero", // admin

  // Discount Codes APIs
  GET_DISCOUNT_CODES: "discount/",
  GET_DISCOUNT_CODE: (id: string) => `discount/${id}/`,
  CREATE_DISCOUNT_CODE: "discount/",
  UPDATE_DISCOUNT_CODE: (id: string) => `discount/${id}/`,
  DELETE_DISCOUNT_CODE: (id: string) => `discount/${id}/`,

  // Orders APIs
  GET_ORDERS: "checkout/orders",
  GET_ORDER: (id: string) => `checkout/orders/${id}`,
  GET_ORDER_STATS: "checkout/orders/statistics",
  UPDATE_ORDER_STATUS: (id: string) => `checkout/orders/${id}/status`,

  // Shipping Methods APIs
  GET_SHIPPING_METHODS: "checkout/shipping-methods",
  GET_SHIPPING_METHOD: (id: string) => `checkout/shipping-methods/${id}`,
  CREATE_SHIPPING_METHOD: "checkout/shipping-methods",
  UPDATE_SHIPPING_METHOD: (id: string) => `checkout/shipping-methods/${id}`,
  DELETE_SHIPPING_METHOD: (id: string) => `checkout/shipping-methods/${id}`,

  // User Admin APIs
  GET_USERS: "users",
  GET_USER: (id: string) => `users/${id}`,
  SEARCH_USERS: "users/search",
  CREATE_USER: "users",
  UPDATE_USER: (id: string) => `users/${id}`,
  UPDATE_USER_PROFILE: (id: string) => `users/${id}/profile`,
  UPDATE_USER_AVATAR: (id: string) => `users/${id}/avatar`,
  DELETE_USER: (id: string) => `users/${id}`,
  VERIFY_USER: (id: string) => `users/${id}/verify`,
  UNVERIFY_USER: (id: string) => `users/${id}/unverify`,
  GET_TICKETS: "tickets",
  GET_TICKET: (id: string) => `tickets/${id}`,
  CREATE_TICKET_REPLY: (id: string) => `tickets/${id}/messages`,
  UPDATE_TICKET_STATUS: (id: string) => `tickets/${id}/status`,
  ASSIGN_TICKET: (id: string) => `tickets/${id}/assign`,
  GET_TICKET_DEPARTMENTS: "tickets/config/departments",
  GET_TICKET_DEPARTMENT: (id: string) => `tickets/config/departments/${id}`,
  CREATE_TICKET_DEPARTMENT: "tickets/config/departments",
  UPDATE_TICKET_DEPARTMENT: (id: string) => `tickets/config/departments/${id}`,
  DELETE_TICKET_DEPARTMENT: (id: string) => `tickets/config/departments/${id}`,
  GET_TICKET_STATUSES: "tickets/config/statuses",
  GET_TICKET_STATUS: (id: string) => `tickets/config/statuses/${id}`,
  CREATE_TICKET_STATUS: "tickets/config/statuses",
  UPDATE_TICKET_STATUS_CONFIG: (id: string) => `tickets/config/statuses/${id}`,
  DELETE_TICKET_STATUS: (id: string) => `tickets/config/statuses/${id}`,
  GET_TICKET_SUBJECTS: "tickets/config/subjects",
  GET_TICKET_SUBJECT: (id: string) => `tickets/config/subjects/${id}`,
  CREATE_TICKET_SUBJECT: "tickets/config/subjects",
  UPDATE_TICKET_SUBJECT: (id: string) => `tickets/config/subjects/${id}`,
  DELETE_TICKET_SUBJECT: (id: string) => `tickets/config/subjects/${id}`,

  // Contact Us APIs
  GET_CONTACT_US_MESSAGES: "contact-us",
  DELETE_CONTACT_US_MESSAGE: (id: string) => `contact-us/${id}`,

  // Payment IPG APIs
  GET_IPG_STATUS: "payment/ipg/status",
  UPDATE_IPG_STATUS: "payment/ipg/status",

  // Payment Card APIs
  GET_PAYMENT_CARD: "payment/card",
  UPDATE_PAYMENT_CARD: "payment/card",

  // Wallet APIs
  GET_WALLET_STATUS: "wallet/status",
  UPDATE_WALLET_STATUS: "wallet/status",

  // Reports APIs
  DISCOUNT_REPORTS: "reports/discounts",
  DISCOUNT_USAGE_REPORT: "reports/discounts/usage",
  CUSTOMER_DISCOUNT_USAGE_REPORT: "reports/discounts/customer-usage",
  PAYMENT_METHODS_REPORT: "reports/payments/methods",
  PAYMENT_TRANSACTIONS_REPORT: "reports/payments/transactions",
  SHIPMENTS_BY_METHOD_REPORT: "reports/shipments/by-method",
  SALES_GROWTH_REPORT: "reports/sales/growth",
  USER_REGISTRATION_GROWTH_REPORT: "reports/user-registration/growth",
  SALES_BY_CATEGORY_REPORT: "reports/sales/by-category",
  SALES_SUMMARY_REPORT: "reports/sales/summary",
  PROFIT_LOSS_REPORT: "reports/profit-loss",
  INVENTORY_VALUE_REPORT: "reports/inventory/value",
  VARIANT_COMPARISON_REPORT: "reports/variants/comparison",

  // Product Comments APIs
  GET_PRODUCT_COMMENTS: "products/comments",
  UPDATE_COMMENT_STATUS: (commentId: string) => `products/comments/${commentId}/status`,
  DELETE_COMMENT: (commentId: string) => `products/comments/${commentId}`,

  // Admin Notifications APIs
  GET_ADMIN_NOTIFICATIONS: "notifications",
  GET_ADMIN_NOTIFICATIONS_UNREAD: "notifications/unread",
  GET_ADMIN_NOTIFICATIONS_COUNT: "notifications/count",
  MARK_NOTIFICATION_READ: (id: string) => `notifications/${id}/read`,
  MARK_ALL_NOTIFICATIONS_READ: "notifications/read-all",

  // System Settings APIs
  GET_AUTO_VERIFY_SETTING: "settings/auto-verify-new-users",
  UPDATE_AUTO_VERIFY_SETTING: "settings/auto-verify-new-users",

  // Wallet Credit APIs
  WALLET_CREDIT: "wallet/credit",
};
