/**
 * Support FAQ Constants
 * Centralized configuration for FAQ management
 */

import type { SupportFAQCategory } from './types';

/** All valid FAQ categories */
export const FAQ_CATEGORIES: readonly SupportFAQCategory[] = [
  'GETTING_STARTED',
  'BILLING',
  'TECHNICAL',
  'WHATSAPP',
  'APPOINTMENTS',
] as const;

/** Staff roles that can manage FAQs (create, update, delete) */
export const FAQ_ADMIN_ROLES = ['ADMIN', 'SUPER_ADMIN'] as const;

/** Error messages for FAQ operations */
export const FAQ_ERRORS = {
  UNAUTHORIZED: 'Unauthorized',
  PERMISSION_DENIED: 'Permission denied',
  NOT_FOUND: 'FAQ not found',
  MISSING_FIELDS: 'Missing required fields: category, question, questionAr, answer, answerAr',
  INVALID_CATEGORY: (categories: readonly string[]) =>
    `Invalid category. Must be one of: ${categories.join(', ')}`,
  FETCH_FAILED: 'Failed to fetch FAQs',
  FETCH_SINGLE_FAILED: 'Failed to fetch FAQ',
  CREATE_FAILED: 'Failed to create FAQ',
  UPDATE_FAILED: 'Failed to update FAQ',
  DELETE_FAILED: 'Failed to delete FAQ',
} as const;

/** Success messages */
export const FAQ_SUCCESS = {
  DELETED: 'FAQ deleted',
} as const;

/** Default values for FAQ creation */
export const FAQ_DEFAULTS = {
  IS_PUBLISHED: false,
  ORDER: 0,
} as const;

/** Fields selected for public API (excludes sensitive data) */
export const FAQ_PUBLIC_SELECT = {
  id: true,
  category: true,
  question: true,
  questionAr: true,
  answer: true,
  answerAr: true,
  order: true,
} as const;

/** Default ordering for FAQ lists */
export const FAQ_DEFAULT_ORDER = [
  { category: 'asc' as const },
  { order: 'asc' as const },
  { createdAt: 'desc' as const },
];

/** Ordering for public FAQ lists (without createdAt) */
export const FAQ_PUBLIC_ORDER = [
  { category: 'asc' as const },
  { order: 'asc' as const },
];
