export type SeedHelpCategory = {
  id: string;
  key: string;
  title: string;
};

export type ContentBlock =
  | { type: "paragraph"; text: string }
  | { type: "heading"; level: 2 | 3; text: string }
  | { type: "list"; items: string[]; ordered?: boolean }
  | { type: "section"; title: string; blocks: ContentBlock[] };

export type SeedHelpArticle = {
  id: string;
  slug: string;
  title: string;
  summary: string;
  categoryKey: string;
  category: string;
  role: "ALL" | "company" | "jobSeeker" | "professional" | "customer" | "platform";
  tags: string[];
  updatedAt: string;
  content: ContentBlock[];
};

// Categories matching the admin panel KB management
export const HELP_CENTER_SEED_CATEGORIES: SeedHelpCategory[] = [
  { id: "seed-cat-verifications", key: "verifications", title: "Verifications" },
  { id: "seed-cat-lead-system", key: "lead-system", title: "Lead System" },
  { id: "seed-cat-credits-payments", key: "credits-payments", title: "Credits & Payments" },
  { id: "seed-cat-account-profiles", key: "account-profiles", title: "Account & Profiles" },
  { id: "seed-cat-security", key: "security", title: "Security" },
  { id: "seed-cat-troubleshooting", key: "troubleshooting", title: "Troubleshooting" },
  { id: "seed-cat-policies", key: "policies", title: "Policies" },
  { id: "seed-cat-general", key: "general", title: "General" },
];

const updatedAt = "2026-04-06T00:00:00.000Z";

// ========== VERIFICATIONS ==========
const businessApprovalContent: ContentBlock[] = [
  { type: "heading", level: 2, text: "Overview" },
  {
    type: "paragraph",
    text: "Business approval is required for companies and professional service providers to verify their legitimacy on the Nxtgauge platform.",
  },
  { type: "heading", level: 2, text: "Required Documents" },
  {
    type: "list",
    items: [
      "Business registration certificate",
      "Tax identification number",
      "Proof of address (utility bill or lease agreement)",
      "Identity verification of business owner/director",
    ],
  },
  { type: "heading", level: 2, text: "Approval Timeline" },
  {
    type: "paragraph",
    text: "Business verification typically takes 24-48 hours. Complex cases may require up to 5 business days.",
  },
  { type: "heading", level: 2, text: "What Happens After Approval" },
  {
    type: "list",
    items: [
      "Verified badge appears on your profile",
      "Full platform features unlocked",
      "Higher visibility in search results",
      "Ability to post jobs and receive leads",
    ],
  },
];

const identityVerificationContent: ContentBlock[] = [
  { type: "heading", level: 2, text: "Why Identity Verification Matters" },
  {
    type: "paragraph",
    text: "Identity verification helps maintain trust and safety on the Nxtgauge platform for all users.",
  },
  { type: "heading", level: 2, text: "Acceptable Documents" },
  {
    type: "section",
    title: "Primary ID",
    blocks: [
      {
        type: "list",
        items: ["Passport", "Driver license", "National ID card", "Government-issued photo ID"],
      },
    ],
  },
  {
    type: "section",
    title: "Address Proof",
    blocks: [
      {
        type: "list",
        items: [
          "Bank statement (last 3 months)",
          "Utility bill",
          "Rental agreement",
          "Government correspondence",
        ],
      },
    ],
  },
  { type: "heading", level: 2, text: "Photo Requirements" },
  {
    type: "list",
    items: [
      "Clear, high-resolution image",
      "All corners visible",
      "No glare or shadows",
      "Valid (not expired) document",
    ],
  },
];

// ========== LEAD SYSTEM ==========
const howToFindLeadsContent: ContentBlock[] = [
  { type: "heading", level: 2, text: "Understanding the Lead System" },
  {
    type: "paragraph",
    text: "Leads are potential customers who have expressed interest in services matching your expertise.",
  },
  { type: "heading", level: 2, text: "Finding Leads" },
  {
    type: "list",
    items: [
      "Check your Leads dashboard daily",
      "Set up lead alerts for your service categories",
      "Use filters to find high-quality matches",
      "Respond quickly to new leads",
    ],
    ordered: true,
  },
  { type: "heading", level: 2, text: "Lead Quality Indicators" },
  {
    type: "list",
    items: [
      "Budget range specified",
      "Detailed requirements provided",
      "Timeline clearly defined",
      "Previous platform activity",
    ],
  },
];

const responseQualityContent: ContentBlock[] = [
  { type: "heading", level: 2, text: "Crafting Effective Responses" },
  {
    type: "paragraph",
    text: "Your response quality directly impacts your conversion rate and reputation on the platform.",
  },
  { type: "heading", level: 2, text: "Best Practices" },
  {
    type: "list",
    items: [
      "Personalize each response to the specific requirement",
      "Highlight relevant experience and portfolio items",
      "Provide clear pricing or rate information",
      "Ask clarifying questions when needed",
      "Maintain professional and courteous tone",
    ],
  },
  { type: "heading", level: 2, text: "Response Timing" },
  {
    type: "paragraph",
    text: "Responding within the first hour increases your chances of conversion by 70%.",
  },
];

// ========== CREDITS & PAYMENTS ==========
const whatAreTracecoinsContent: ContentBlock[] = [
  { type: "heading", level: 2, text: "What Are Tracecoins" },
  {
    type: "paragraph",
    text: "Tracecoins are Nxtgauge platform credits used to unlock premium features and contact leads.",
  },
  { type: "heading", level: 2, text: "How to Use Tracecoins" },
  {
    type: "list",
    items: [
      "Unlock lead contact details",
      "Boost profile visibility",
      "Access premium job postings",
      "Feature your services",
    ],
  },
  { type: "heading", level: 2, text: "Purchasing Tracecoins" },
  {
    type: "paragraph",
    text: "Buy Tracecoins in bundles through the Credits & Billing section. Various payment methods accepted.",
  },
  { type: "heading", level: 2, text: "Do Tracecoins Expire" },
  { type: "paragraph", text: "Tracecoins remain valid for 12 months from the date of purchase." },
];

const refundPolicyContent: ContentBlock[] = [
  { type: "heading", level: 2, text: "Refund Policy Overview" },
  {
    type: "paragraph",
    text: "Nxtgauge offers refunds under specific circumstances to ensure fair usage of credits.",
  },
  { type: "heading", level: 2, text: "Eligible for Refund" },
  {
    type: "list",
    items: [
      "Technical errors preventing lead contact",
      "Fraudulent lead submissions",
      "Duplicate charges",
      "Unused credits within 7 days of purchase",
    ],
  },
  { type: "heading", level: 2, text: "Not Eligible for Refund" },
  {
    type: "list",
    items: [
      "Lead did not respond to your message",
      "Client chose another provider",
      "Change of mind after credit usage",
      "Credits expired after 12 months",
    ],
  },
  { type: "heading", level: 2, text: "How to Request a Refund" },
  {
    type: "paragraph",
    text: "Submit a refund request through the support ticket system with transaction details and reason.",
  },
];

// ========== ACCOUNT & PROFILES ==========
const portfolioBestPracticesContent: ContentBlock[] = [
  { type: "heading", level: 2, text: "Building a Strong Portfolio" },
  {
    type: "paragraph",
    text: "Your portfolio showcases your skills and helps potential clients understand your capabilities.",
  },
  { type: "heading", level: 2, text: "Portfolio Essentials" },
  {
    type: "list",
    items: [
      "High-quality images of completed work",
      "Detailed project descriptions",
      "Client testimonials and reviews",
      "Clear categorization by service type",
      "Regular updates with recent work",
    ],
  },
  { type: "heading", level: 2, text: "Image Guidelines" },
  {
    type: "list",
    items: [
      "Minimum resolution: 1200x800 pixels",
      "Professional lighting and composition",
      "Before/after comparisons where applicable",
      "Consistent style across portfolio",
    ],
  },
];

const serviceSwitchingContent: ContentBlock[] = [
  { type: "heading", level: 2, text: "Switching Between Services" },
  {
    type: "paragraph",
    text: "Nxtgauge allows professionals to offer multiple services under one account.",
  },
  { type: "heading", level: 2, text: "How to Add Services" },
  {
    type: "list",
    items: [
      "Go to Profile Settings",
      "Select Service Categories",
      "Add new service areas",
      "Complete verification for each service",
      "Update portfolio for new services",
    ],
    ordered: true,
  },
  { type: "heading", level: 2, text: "Managing Multiple Services" },
  {
    type: "paragraph",
    text: "Each service has its own leads, reviews, and portfolio. Keep all services updated for best results.",
  },
];

// ========== SECURITY ==========
const passwordRecoveryContent: ContentBlock[] = [
  { type: "heading", level: 2, text: "Resetting Your Password" },
  {
    type: "paragraph",
    text: "Forgot your password? Follow these steps to regain access to your account.",
  },
  { type: "heading", level: 2, text: "Password Reset Steps" },
  {
    type: "list",
    items: [
      "Click Forgot Password on login screen",
      "Enter your registered email or phone",
      "Receive OTP via email or SMS",
      "Enter OTP and create new password",
      "Log in with new credentials",
    ],
    ordered: true,
  },
  { type: "heading", level: 2, text: "Password Requirements" },
  {
    type: "list",
    items: [
      "Minimum 8 characters",
      "At least one uppercase letter",
      "At least one number",
      "At least one special character",
    ],
  },
];

const twoFactorAuthContent: ContentBlock[] = [
  { type: "heading", level: 2, text: "Two-Factor Authentication (2FA)" },
  { type: "paragraph", text: "Add an extra layer of security to your Nxtgauge account with 2FA." },
  { type: "heading", level: 2, text: "Setting Up 2FA" },
  {
    type: "list",
    items: [
      "Go to Security Settings",
      "Enable Two-Factor Authentication",
      "Choose SMS or Authenticator App",
      "Verify your device",
      "Save backup codes securely",
    ],
    ordered: true,
  },
  { type: "heading", level: 2, text: "Using 2FA" },
  {
    type: "paragraph",
    text: "After entering your password, you will receive a code via your chosen method. Enter this code to complete login.",
  },
];

// ========== TROUBLESHOOTING ==========
const appPerformanceContent: ContentBlock[] = [
  { type: "heading", level: 2, text: "Improving App Performance" },
  {
    type: "paragraph",
    text: "Experiencing slow loading or crashes? Try these troubleshooting steps.",
  },
  { type: "heading", level: 2, text: "Quick Fixes" },
  {
    type: "list",
    items: [
      "Clear browser cache and cookies",
      "Update to latest browser version",
      "Disable unnecessary browser extensions",
      "Check internet connection stability",
      "Try incognito/private browsing mode",
    ],
  },
  { type: "heading", level: 2, text: "Still Having Issues" },
  {
    type: "paragraph",
    text: "Contact support with details about your browser, device, and the specific issue you are experiencing.",
  },
];

const notificationSettingsContent: ContentBlock[] = [
  { type: "heading", level: 2, text: "Managing Notifications" },
  { type: "paragraph", text: "Customize how and when you receive alerts from Nxtgauge." },
  { type: "heading", level: 2, text: "Notification Types" },
  {
    type: "list",
    items: [
      "New lead alerts",
      "Message notifications",
      "Application status updates",
      "Platform announcements",
      "Payment confirmations",
    ],
  },
  { type: "heading", level: 2, text: "Delivery Methods" },
  {
    type: "list",
    items: [
      "Email notifications",
      "SMS alerts",
      "In-app notifications",
      "Push notifications (mobile app)",
    ],
  },
];

// ========== POLICIES ==========
const termsOfServiceContent: ContentBlock[] = [
  { type: "heading", level: 2, text: "Terms of Service Overview" },
  {
    type: "paragraph",
    text: "By using Nxtgauge, you agree to comply with our terms of service designed to ensure a safe and fair platform.",
  },
  { type: "heading", level: 2, text: "Key Points" },
  {
    type: "list",
    items: [
      "Provide accurate and truthful information",
      "Respect intellectual property rights",
      "Do not engage in fraudulent activities",
      "Maintain professional conduct in all interactions",
      "Comply with applicable laws and regulations",
    ],
  },
  { type: "heading", level: 2, text: "Account Responsibilities" },
  {
    type: "paragraph",
    text: "You are responsible for all activity on your account. Keep your credentials secure and report unauthorized access immediately.",
  },
];

const privacyPolicyContent: ContentBlock[] = [
  { type: "heading", level: 2, text: "Privacy Policy" },
  {
    type: "paragraph",
    text: "Nxtgauge is committed to protecting your privacy and personal data.",
  },
  { type: "heading", level: 2, text: "Data We Collect" },
  {
    type: "list",
    items: [
      "Account registration information",
      "Profile and service details",
      "Communication records",
      "Transaction history",
      "Usage analytics",
    ],
  },
  { type: "heading", level: 2, text: "How We Use Your Data" },
  {
    type: "list",
    items: [
      "Provide and improve platform services",
      "Match you with relevant opportunities",
      "Process payments and transactions",
      "Ensure platform security",
      "Communicate important updates",
    ],
  },
  { type: "heading", level: 2, text: "Your Rights" },
  {
    type: "paragraph",
    text: "You have the right to access, modify, or delete your personal data. Contact support for data-related requests.",
  },
];

// ========== GENERAL ==========
const welcomeGuideContent: ContentBlock[] = [
  { type: "heading", level: 2, text: "Welcome to Nxtgauge" },
  {
    type: "paragraph",
    text: "Your journey to finding the right opportunities and connections starts here.",
  },
  { type: "heading", level: 2, text: "Getting Started" },
  {
    type: "list",
    items: [
      "Complete your profile with accurate information",
      "Verify your account for full access",
      "Set up your service categories or job preferences",
      "Upload portfolio or resume",
      "Start exploring leads or job postings",
    ],
    ordered: true,
  },
  { type: "heading", level: 2, text: "Need Help" },
  { type: "paragraph", text: "Browse our help center articles or contact support for assistance." },
];

const masteringDashboardContent: ContentBlock[] = [
  { type: "heading", level: 2, text: "Understanding Your Dashboard" },
  {
    type: "paragraph",
    text: "Your dashboard is the central hub for managing your Nxtgauge activities.",
  },
  { type: "heading", level: 2, text: "Dashboard Sections" },
  {
    type: "section",
    title: "Overview",
    blocks: [
      {
        type: "paragraph",
        text: "Quick summary of your account activity, new leads, and pending actions.",
      },
    ],
  },
  {
    type: "section",
    title: "Leads/Applications",
    blocks: [
      {
        type: "paragraph",
        text: "View and manage your leads or job applications with status tracking.",
      },
    ],
  },
  {
    type: "section",
    title: "Messages",
    blocks: [
      { type: "paragraph", text: "Communicate with clients, employers, or service providers." },
    ],
  },
  {
    type: "section",
    title: "Profile",
    blocks: [
      { type: "paragraph", text: "Update your information, portfolio, and service settings." },
    ],
  },
  { type: "heading", level: 2, text: "Customization" },
  {
    type: "paragraph",
    text: "Personalize your dashboard layout and notification preferences for optimal workflow.",
  },
];

export const HELP_CENTER_SEED_ARTICLES: SeedHelpArticle[] = [
  // Verifications
  {
    id: "seed-verif-1",
    slug: "business-approval",
    title: "Business Approval",
    summary: "Guide to getting your business verified on Nxtgauge.",
    categoryKey: "verifications",
    category: "Verifications",
    role: "ALL",
    tags: ["business", "verification", "approval"],
    updatedAt,
    content: businessApprovalContent,
  },
  {
    id: "seed-verif-2",
    slug: "identity-verification",
    title: "Identity Verification",
    summary: "How to verify your identity with acceptable documents.",
    categoryKey: "verifications",
    category: "Verifications",
    role: "ALL",
    tags: ["identity", "verification", "documents"],
    updatedAt,
    content: identityVerificationContent,
  },
  // Lead System
  {
    id: "seed-lead-1",
    slug: "how-to-find-leads",
    title: "How to Find Leads",
    summary: "Discover potential clients and opportunities on the platform.",
    categoryKey: "lead-system",
    category: "Lead System",
    role: "professional",
    tags: ["leads", "opportunities", "finding"],
    updatedAt,
    content: howToFindLeadsContent,
  },
  {
    id: "seed-lead-2",
    slug: "response-quality",
    title: "Response Quality",
    summary: "Best practices for responding to leads effectively.",
    categoryKey: "lead-system",
    category: "Lead System",
    role: "professional",
    tags: ["response", "leads", "communication"],
    updatedAt,
    content: responseQualityContent,
  },
  // Credits & Payments
  {
    id: "seed-pay-1",
    slug: "what-are-tracecoins",
    title: "What are Tracecoins",
    summary: "Understanding platform credits and how to use them.",
    categoryKey: "credits-payments",
    category: "Credits & Payments",
    role: "ALL",
    tags: ["credits", "tracecoins", "payments"],
    updatedAt,
    content: whatAreTracecoinsContent,
  },
  {
    id: "seed-pay-2",
    slug: "refund-policy",
    title: "Refund Policy",
    summary: "When and how you can request refunds for credits.",
    categoryKey: "credits-payments",
    category: "Credits & Payments",
    role: "ALL",
    tags: ["refund", "policy", "credits"],
    updatedAt,
    content: refundPolicyContent,
  },
  // Account & Profiles
  {
    id: "seed-acc-1",
    slug: "portfolio-best-practices",
    title: "Portfolio Best Practices",
    summary: "Build a compelling portfolio to attract clients.",
    categoryKey: "account-profiles",
    category: "Account & Profiles",
    role: "professional",
    tags: ["portfolio", "profile", "best practices"],
    updatedAt,
    content: portfolioBestPracticesContent,
  },
  {
    id: "seed-acc-2",
    slug: "service-switching",
    title: "Service Switching",
    summary: "How to add and manage multiple services.",
    categoryKey: "account-profiles",
    category: "Account & Profiles",
    role: "professional",
    tags: ["services", "switching", "management"],
    updatedAt,
    content: serviceSwitchingContent,
  },
  // Security
  {
    id: "seed-sec-1",
    slug: "password-recovery",
    title: "Password Recovery",
    summary: "Reset your password and regain account access.",
    categoryKey: "security",
    category: "Security",
    role: "ALL",
    tags: ["password", "recovery", "login"],
    updatedAt,
    content: passwordRecoveryContent,
  },
  {
    id: "seed-sec-2",
    slug: "2fa-setup",
    title: "2FA Setup",
    summary: "Enable two-factor authentication for extra security.",
    categoryKey: "security",
    category: "Security",
    role: "ALL",
    tags: ["2fa", "security", "authentication"],
    updatedAt,
    content: twoFactorAuthContent,
  },
  // Troubleshooting
  {
    id: "seed-trouble-1",
    slug: "app-performance",
    title: "App Performance",
    summary: "Fix slow loading and performance issues.",
    categoryKey: "troubleshooting",
    category: "Troubleshooting",
    role: "ALL",
    tags: ["performance", "issues", "fix"],
    updatedAt,
    content: appPerformanceContent,
  },
  {
    id: "seed-trouble-2",
    slug: "notification-settings",
    title: "Notification Settings",
    summary: "Manage your notification preferences.",
    categoryKey: "troubleshooting",
    category: "Troubleshooting",
    role: "ALL",
    tags: ["notifications", "settings", "alerts"],
    updatedAt,
    content: notificationSettingsContent,
  },
  // Policies
  {
    id: "seed-policy-1",
    slug: "terms-of-service",
    title: "Terms of Service",
    summary: "Platform terms and conditions all users must follow.",
    categoryKey: "policies",
    category: "Policies",
    role: "ALL",
    tags: ["terms", "service", "policy"],
    updatedAt,
    content: termsOfServiceContent,
  },
  {
    id: "seed-policy-2",
    slug: "privacy-policy",
    title: "Privacy Policy",
    summary: "How we collect, use, and protect your data.",
    categoryKey: "policies",
    category: "Policies",
    role: "ALL",
    tags: ["privacy", "data", "policy"],
    updatedAt,
    content: privacyPolicyContent,
  },
  // General
  {
    id: "seed-gen-1",
    slug: "welcome-guide",
    title: "Welcome Guide",
    summary: "Get started with Nxtgauge platform.",
    categoryKey: "general",
    category: "General",
    role: "ALL",
    tags: ["welcome", "getting started", "guide"],
    updatedAt,
    content: welcomeGuideContent,
  },
  {
    id: "seed-gen-2",
    slug: "mastering-dashboard",
    title: "Mastering the Dashboard",
    summary: "Navigate and customize your dashboard effectively.",
    categoryKey: "general",
    category: "General",
    role: "ALL",
    tags: ["dashboard", "navigation", "guide"],
    updatedAt,
    content: masteringDashboardContent,
  },
];
