/**
 * Voice Agent Workflow Templates
 *
 * Pre-built workflow templates for common business scenarios.
 * Each template defines a conversation flow as a graph of nodes and edges.
 */

export interface WorkflowNode {
  id: string;
  type: "start" | "prompt" | "tool_call" | "condition" | "end";
  label: { en: string; ar: string };
  prompt?: string;
  toolName?: string;
  condition?: string;
}

export interface WorkflowEdge {
  from: string;
  to: string;
  label?: string;
  condition?: string;
}

export interface WorkflowTemplate {
  id: string;
  name: { en: string; ar: string };
  description: { en: string; ar: string };
  category: string;
  nodes: WorkflowNode[];
  edges: WorkflowEdge[];
  customizationFields: Array<{
    key: string;
    label: { en: string; ar: string };
    type: "text" | "select" | "multiselect";
    options?: Array<{ value: string; label: string }>;
    defaultValue?: string;
  }>;
}

export const WORKFLOW_TEMPLATES: WorkflowTemplate[] = [
  {
    id: "booking_flow",
    name: { en: "Booking Flow", ar: "حجز موعد" },
    description: {
      en: "Complete appointment booking: greeting, service selection, date/time, confirmation",
      ar: "حجز موعد كامل: ترحيب، اختيار الخدمة، التاريخ/الوقت، تأكيد",
    },
    category: "booking",
    nodes: [
      { id: "start", type: "start", label: { en: "Start", ar: "بداية" } },
      {
        id: "greet",
        type: "prompt",
        label: { en: "Greeting", ar: "ترحيب" },
        prompt: "Greet the caller and ask how you can help.",
      },
      {
        id: "service",
        type: "prompt",
        label: { en: "Service Selection", ar: "اختيار الخدمة" },
        prompt: "Ask which service they would like to book.",
      },
      {
        id: "check",
        type: "tool_call",
        label: { en: "Check Availability", ar: "التحقق من التوفر" },
        toolName: "check_availability",
      },
      {
        id: "confirm",
        type: "prompt",
        label: { en: "Confirm Details", ar: "تأكيد التفاصيل" },
        prompt: "Confirm the appointment details with the caller.",
      },
      {
        id: "book",
        type: "tool_call",
        label: { en: "Create Booking", ar: "إنشاء الحجز" },
        toolName: "create_booking",
      },
      {
        id: "farewell",
        type: "prompt",
        label: { en: "Goodbye", ar: "وداع" },
        prompt: "Thank the caller and wish them well.",
      },
      { id: "end", type: "end", label: { en: "End", ar: "نهاية" } },
    ],
    edges: [
      { from: "start", to: "greet" },
      { from: "greet", to: "service" },
      { from: "service", to: "check" },
      { from: "check", to: "confirm", condition: "available" },
      {
        from: "check",
        to: "service",
        label: "Not available",
        condition: "unavailable",
      },
      { from: "confirm", to: "book" },
      { from: "book", to: "farewell" },
      { from: "farewell", to: "end" },
    ],
    customizationFields: [
      {
        key: "services",
        label: { en: "Available Services", ar: "الخدمات المتاحة" },
        type: "text",
        defaultValue: "Consultation, Follow-up, Assessment",
      },
      {
        key: "confirmationMessage",
        label: { en: "Confirmation Message", ar: "رسالة التأكيد" },
        type: "text",
        defaultValue: "Your appointment has been booked successfully.",
      },
    ],
  },
  {
    id: "faq_flow",
    name: { en: "FAQ Flow", ar: "أسئلة شائعة" },
    description: {
      en: "Answer questions from knowledge base with follow-up handling",
      ar: "الإجابة على الأسئلة من قاعدة المعرفة مع المتابعة",
    },
    category: "support",
    nodes: [
      { id: "start", type: "start", label: { en: "Start", ar: "بداية" } },
      {
        id: "greet",
        type: "prompt",
        label: { en: "Greeting", ar: "ترحيب" },
        prompt: "Greet the caller and ask what information they need.",
      },
      {
        id: "classify",
        type: "condition",
        label: { en: "Classify Question", ar: "تصنيف السؤال" },
        condition:
          "Determine if the question can be answered from the knowledge base.",
      },
      {
        id: "answer",
        type: "prompt",
        label: { en: "Answer from KB", ar: "إجابة من المعرفة" },
        prompt: "Answer the question using the knowledge base.",
      },
      {
        id: "followup",
        type: "prompt",
        label: { en: "Follow-up", ar: "متابعة" },
        prompt: "Ask if they have any other questions.",
      },
      {
        id: "escalate",
        type: "prompt",
        label: { en: "Escalate", ar: "تصعيد" },
        prompt:
          "Transfer to a human agent for questions outside the knowledge base.",
      },
      {
        id: "farewell",
        type: "prompt",
        label: { en: "Goodbye", ar: "وداع" },
        prompt: "Thank the caller.",
      },
      { id: "end", type: "end", label: { en: "End", ar: "نهاية" } },
    ],
    edges: [
      { from: "start", to: "greet" },
      { from: "greet", to: "classify" },
      { from: "classify", to: "answer", condition: "answerable" },
      { from: "classify", to: "escalate", condition: "not_answerable" },
      { from: "answer", to: "followup" },
      { from: "followup", to: "classify", condition: "has_more_questions" },
      { from: "followup", to: "farewell", condition: "no_more_questions" },
      { from: "escalate", to: "end" },
      { from: "farewell", to: "end" },
    ],
    customizationFields: [
      {
        key: "escalationMessage",
        label: { en: "Escalation Message", ar: "رسالة التصعيد" },
        type: "text",
        defaultValue: "Let me connect you with someone who can help with that.",
      },
    ],
  },
  {
    id: "triage_flow",
    name: { en: "Triage Flow", ar: "فرز المكالمات" },
    description: {
      en: "Assess urgency and route to booking, escalation, or information",
      ar: "تقييم الأولوية والتوجيه للحجز أو التصعيد أو المعلومات",
    },
    category: "triage",
    nodes: [
      { id: "start", type: "start", label: { en: "Start", ar: "بداية" } },
      {
        id: "greet",
        type: "prompt",
        label: { en: "Greeting", ar: "ترحيب" },
        prompt: "Greet the caller warmly.",
      },
      {
        id: "assess",
        type: "condition",
        label: { en: "Assess Urgency", ar: "تقييم الأولوية" },
        condition:
          "Determine if the request is urgent, needs booking, or is informational.",
      },
      {
        id: "book",
        type: "prompt",
        label: { en: "Route to Booking", ar: "التوجيه للحجز" },
        prompt: "Help the caller book an appointment.",
      },
      {
        id: "urgent",
        type: "prompt",
        label: { en: "Escalate Urgent", ar: "تصعيد عاجل" },
        prompt:
          "This is urgent. Transfer to the next available staff member immediately.",
      },
      {
        id: "info",
        type: "prompt",
        label: { en: "Provide Information", ar: "تقديم معلومات" },
        prompt: "Answer the caller's informational question.",
      },
      {
        id: "farewell",
        type: "prompt",
        label: { en: "Goodbye", ar: "وداع" },
        prompt: "Thank the caller and wish them well.",
      },
      { id: "end", type: "end", label: { en: "End", ar: "نهاية" } },
    ],
    edges: [
      { from: "start", to: "greet" },
      { from: "greet", to: "assess" },
      { from: "assess", to: "book", condition: "booking_needed" },
      { from: "assess", to: "urgent", condition: "urgent" },
      { from: "assess", to: "info", condition: "informational" },
      { from: "book", to: "farewell" },
      { from: "urgent", to: "end" },
      { from: "info", to: "farewell" },
      { from: "farewell", to: "end" },
    ],
    customizationFields: [
      {
        key: "urgencyKeywords",
        label: { en: "Urgency Keywords", ar: "كلمات الأولوية" },
        type: "text",
        defaultValue: "emergency, urgent, pain, bleeding, accident",
      },
    ],
  },

  // ── Food & Hospitality ──────────────────────────────────────────────
  {
    id: "order_flow",
    name: { en: "Order Flow", ar: "طلب طعام" },
    description: {
      en: "Complete food ordering: greeting, menu selection, dietary needs, delivery or pickup",
      ar: "طلب طعام كامل: ترحيب، اختيار من القائمة، احتياجات غذائية، توصيل أو استلام",
    },
    category: "order",
    nodes: [
      { id: "start", type: "start", label: { en: "Start", ar: "بداية" } },
      {
        id: "greet",
        type: "prompt",
        label: { en: "Greeting", ar: "ترحيب" },
        prompt: "Greet the caller and ask what they would like to order.",
      },
      {
        id: "order_items",
        type: "prompt",
        label: { en: "Take Order", ar: "أخذ الطلب" },
        prompt: "Ask what items they would like to order from the menu.",
      },
      {
        id: "check_menu",
        type: "tool_call",
        label: { en: "Check Menu Availability", ar: "التحقق من توفر القائمة" },
        toolName: "check_menu_availability",
      },
      {
        id: "customizations",
        type: "prompt",
        label: { en: "Customizations & Dietary", ar: "التخصيصات والاحتياجات الغذائية" },
        prompt:
          "Ask about any customizations, dietary restrictions, or allergies.",
      },
      {
        id: "confirm_order",
        type: "prompt",
        label: { en: "Confirm Order", ar: "تأكيد الطلب" },
        prompt: "Read back the full order and confirm with the caller.",
      },
      {
        id: "process_order",
        type: "tool_call",
        label: { en: "Process Order", ar: "معالجة الطلب" },
        toolName: "create_order",
      },
      {
        id: "delivery_branch",
        type: "condition",
        label: { en: "Delivery or Pickup", ar: "توصيل أو استلام" },
        condition: "Determine if the customer wants delivery or pickup.",
      },
      {
        id: "delivery",
        type: "prompt",
        label: { en: "Delivery Details", ar: "تفاصيل التوصيل" },
        prompt: "Collect delivery address and confirm estimated delivery time.",
      },
      {
        id: "pickup",
        type: "prompt",
        label: { en: "Pickup Details", ar: "تفاصيل الاستلام" },
        prompt: "Confirm pickup time and location.",
      },
      {
        id: "farewell",
        type: "prompt",
        label: { en: "Goodbye", ar: "وداع" },
        prompt: "Thank the caller and confirm the order summary.",
      },
      { id: "end", type: "end", label: { en: "End", ar: "نهاية" } },
    ],
    edges: [
      { from: "start", to: "greet" },
      { from: "greet", to: "order_items" },
      { from: "order_items", to: "check_menu" },
      { from: "check_menu", to: "customizations", condition: "available" },
      {
        from: "check_menu",
        to: "order_items",
        label: "Item unavailable",
        condition: "unavailable",
      },
      { from: "customizations", to: "confirm_order" },
      { from: "confirm_order", to: "process_order" },
      { from: "process_order", to: "delivery_branch" },
      { from: "delivery_branch", to: "delivery", condition: "delivery" },
      { from: "delivery_branch", to: "pickup", condition: "pickup" },
      { from: "delivery", to: "farewell" },
      { from: "pickup", to: "farewell" },
      { from: "farewell", to: "end" },
    ],
    customizationFields: [
      {
        key: "menu_categories",
        label: { en: "Menu Categories", ar: "فئات القائمة" },
        type: "text",
        defaultValue: "Appetizers, Main Courses, Desserts, Beverages",
      },
      {
        key: "delivery_area",
        label: { en: "Delivery Area", ar: "منطقة التوصيل" },
        type: "text",
        defaultValue: "Within 10 km radius",
      },
      {
        key: "min_order_amount",
        label: { en: "Minimum Order Amount", ar: "الحد الأدنى للطلب" },
        type: "text",
        defaultValue: "50 QAR",
      },
    ],
  },

  // ── Mobility & Automotive ───────────────────────────────────────────
  {
    id: "rental_flow",
    name: { en: "Rental Flow", ar: "تأجير مركبة" },
    description: {
      en: "Vehicle rental: preference, fleet check, dates, insurance, and confirmation",
      ar: "تأجير مركبة: التفضيلات، التحقق من الأسطول، التواريخ، التأمين، والتأكيد",
    },
    category: "rental",
    nodes: [
      { id: "start", type: "start", label: { en: "Start", ar: "بداية" } },
      {
        id: "greet",
        type: "prompt",
        label: { en: "Greeting", ar: "ترحيب" },
        prompt: "Greet the caller and ask about their rental needs.",
      },
      {
        id: "vehicle_pref",
        type: "prompt",
        label: { en: "Vehicle Preference", ar: "تفضيل المركبة" },
        prompt:
          "Ask about preferred vehicle type, size, and any special features needed.",
      },
      {
        id: "check_fleet",
        type: "tool_call",
        label: { en: "Check Fleet", ar: "التحقق من الأسطول" },
        toolName: "check_fleet_availability",
      },
      {
        id: "collect_dates",
        type: "prompt",
        label: { en: "Collect Dates", ar: "تحديد التواريخ" },
        prompt: "Ask for pickup and return dates and times.",
      },
      {
        id: "insurance",
        type: "prompt",
        label: { en: "Insurance Options", ar: "خيارات التأمين" },
        prompt:
          "Present available insurance packages and ask the caller to choose.",
      },
      {
        id: "confirm_rental",
        type: "prompt",
        label: { en: "Confirm Rental", ar: "تأكيد التأجير" },
        prompt:
          "Confirm vehicle, dates, insurance, and total cost with the caller.",
      },
      {
        id: "create_rental",
        type: "tool_call",
        label: { en: "Create Rental", ar: "إنشاء التأجير" },
        toolName: "create_rental",
      },
      {
        id: "farewell",
        type: "prompt",
        label: { en: "Goodbye", ar: "وداع" },
        prompt:
          "Thank the caller and provide pickup instructions.",
      },
      { id: "end", type: "end", label: { en: "End", ar: "نهاية" } },
    ],
    edges: [
      { from: "start", to: "greet" },
      { from: "greet", to: "vehicle_pref" },
      { from: "vehicle_pref", to: "check_fleet" },
      { from: "check_fleet", to: "collect_dates", condition: "available" },
      {
        from: "check_fleet",
        to: "vehicle_pref",
        label: "Not available",
        condition: "unavailable",
      },
      { from: "collect_dates", to: "insurance" },
      { from: "insurance", to: "confirm_rental" },
      { from: "confirm_rental", to: "create_rental" },
      { from: "create_rental", to: "farewell" },
      { from: "farewell", to: "end" },
    ],
    customizationFields: [
      {
        key: "vehicle_classes",
        label: { en: "Vehicle Classes", ar: "فئات المركبات" },
        type: "text",
        defaultValue: "Economy, Compact, SUV, Luxury, Van",
      },
      {
        key: "insurance_options",
        label: { en: "Insurance Options", ar: "خيارات التأمين" },
        type: "text",
        defaultValue: "Basic, Full Coverage, Premium",
      },
      {
        key: "pickup_locations",
        label: { en: "Pickup Locations", ar: "مواقع الاستلام" },
        type: "text",
        defaultValue: "Airport, City Center, Hotel Delivery",
      },
    ],
  },

  // ── Education ───────────────────────────────────────────────────────
  {
    id: "enrollment_flow",
    name: { en: "Enrollment Flow", ar: "تسجيل في دورة" },
    description: {
      en: "Course enrollment: inquiry, level assessment, scheduling, and confirmation",
      ar: "التسجيل في دورة: استفسار، تقييم المستوى، جدولة، وتأكيد",
    },
    category: "enrollment",
    nodes: [
      { id: "start", type: "start", label: { en: "Start", ar: "بداية" } },
      {
        id: "greet",
        type: "prompt",
        label: { en: "Greeting", ar: "ترحيب" },
        prompt: "Greet the caller and ask about their learning interests.",
      },
      {
        id: "course_inquiry",
        type: "prompt",
        label: { en: "Course Inquiry", ar: "استفسار عن الدورة" },
        prompt:
          "Ask which course or program they are interested in and provide available options.",
      },
      {
        id: "assess_level",
        type: "condition",
        label: { en: "Assess Level", ar: "تقييم المستوى" },
        condition:
          "Determine if the student needs a placement assessment or already knows their level.",
      },
      {
        id: "run_assessment",
        type: "tool_call",
        label: { en: "Run Assessment", ar: "إجراء التقييم" },
        toolName: "run_placement_assessment",
      },
      {
        id: "schedule",
        type: "prompt",
        label: { en: "Schedule", ar: "الجدولة" },
        prompt: "Present available class times and ask for preferred schedule.",
      },
      {
        id: "confirm_enrollment",
        type: "prompt",
        label: { en: "Confirm Enrollment", ar: "تأكيد التسجيل" },
        prompt:
          "Confirm the course, schedule, fees, and enrollment details with the caller.",
      },
      {
        id: "create_enrollment",
        type: "tool_call",
        label: { en: "Create Enrollment", ar: "إنشاء التسجيل" },
        toolName: "create_enrollment",
      },
      {
        id: "farewell",
        type: "prompt",
        label: { en: "Goodbye", ar: "وداع" },
        prompt:
          "Thank the caller and provide next steps for their enrollment.",
      },
      { id: "end", type: "end", label: { en: "End", ar: "نهاية" } },
    ],
    edges: [
      { from: "start", to: "greet" },
      { from: "greet", to: "course_inquiry" },
      { from: "course_inquiry", to: "assess_level" },
      {
        from: "assess_level",
        to: "run_assessment",
        condition: "needs_assessment",
      },
      {
        from: "assess_level",
        to: "schedule",
        label: "Level known",
        condition: "level_known",
      },
      { from: "run_assessment", to: "schedule" },
      { from: "schedule", to: "confirm_enrollment" },
      { from: "confirm_enrollment", to: "create_enrollment" },
      { from: "create_enrollment", to: "farewell" },
      { from: "farewell", to: "end" },
    ],
    customizationFields: [
      {
        key: "available_courses",
        label: { en: "Available Courses", ar: "الدورات المتاحة" },
        type: "text",
        defaultValue: "English, Arabic, Math, Science, Programming",
      },
      {
        key: "age_groups",
        label: { en: "Age Groups", ar: "الفئات العمرية" },
        type: "text",
        defaultValue: "Children (6-12), Teens (13-17), Adults (18+)",
      },
      {
        key: "assessment_required",
        label: { en: "Assessment Required", ar: "التقييم مطلوب" },
        type: "select",
        options: [
          { value: "yes", label: "Yes" },
          { value: "no", label: "No" },
          { value: "optional", label: "Optional" },
        ],
        defaultValue: "optional",
      },
    ],
  },

  // ── Home Services & Trades ──────────────────────────────────────────
  {
    id: "job_request_flow",
    name: { en: "Job Request Flow", ar: "طلب خدمة منزلية" },
    description: {
      en: "Home service request: issue description, urgency assessment, address, estimate, scheduling",
      ar: "طلب خدمة منزلية: وصف المشكلة، تقييم الأولوية، العنوان، التقدير، الجدولة",
    },
    category: "job_request",
    nodes: [
      { id: "start", type: "start", label: { en: "Start", ar: "بداية" } },
      {
        id: "greet",
        type: "prompt",
        label: { en: "Greeting", ar: "ترحيب" },
        prompt: "Greet the caller and ask how you can help with their home.",
      },
      {
        id: "describe_issue",
        type: "prompt",
        label: { en: "Describe Issue", ar: "وصف المشكلة" },
        prompt:
          "Ask the caller to describe the issue or service they need in detail.",
      },
      {
        id: "assess_urgency",
        type: "condition",
        label: { en: "Assess Urgency", ar: "تقييم الأولوية" },
        condition:
          "Determine if this is an emergency requiring immediate dispatch or a routine job.",
      },
      {
        id: "emergency_dispatch",
        type: "tool_call",
        label: { en: "Emergency Dispatch", ar: "إرسال طوارئ" },
        toolName: "dispatch_emergency",
      },
      {
        id: "collect_address",
        type: "prompt",
        label: { en: "Collect Address", ar: "جمع العنوان" },
        prompt: "Collect the service address and any access instructions.",
      },
      {
        id: "estimate",
        type: "tool_call",
        label: { en: "Generate Estimate", ar: "إنشاء تقدير" },
        toolName: "generate_estimate",
      },
      {
        id: "schedule_job",
        type: "prompt",
        label: { en: "Schedule Job", ar: "جدولة العمل" },
        prompt:
          "Present available time slots and confirm the preferred appointment.",
      },
      {
        id: "create_job",
        type: "tool_call",
        label: { en: "Create Job", ar: "إنشاء طلب العمل" },
        toolName: "create_job_request",
      },
      {
        id: "farewell",
        type: "prompt",
        label: { en: "Goodbye", ar: "وداع" },
        prompt:
          "Thank the caller and confirm the technician will arrive at the scheduled time.",
      },
      { id: "end", type: "end", label: { en: "End", ar: "نهاية" } },
    ],
    edges: [
      { from: "start", to: "greet" },
      { from: "greet", to: "describe_issue" },
      { from: "describe_issue", to: "assess_urgency" },
      {
        from: "assess_urgency",
        to: "emergency_dispatch",
        condition: "emergency",
      },
      {
        from: "assess_urgency",
        to: "collect_address",
        label: "Routine",
        condition: "routine",
      },
      { from: "emergency_dispatch", to: "end" },
      { from: "collect_address", to: "estimate" },
      { from: "estimate", to: "schedule_job" },
      { from: "schedule_job", to: "create_job" },
      { from: "create_job", to: "farewell" },
      { from: "farewell", to: "end" },
    ],
    customizationFields: [
      {
        key: "service_types",
        label: { en: "Service Types", ar: "أنواع الخدمات" },
        type: "text",
        defaultValue:
          "Plumbing, Electrical, AC Repair, Painting, Carpentry, Cleaning",
      },
      {
        key: "emergency_surcharge",
        label: { en: "Emergency Surcharge", ar: "رسوم الطوارئ" },
        type: "text",
        defaultValue: "50% surcharge for emergency calls",
      },
      {
        key: "service_area",
        label: { en: "Service Area", ar: "منطقة الخدمة" },
        type: "text",
        defaultValue: "Doha, Al Wakrah, Al Khor, Lusail",
      },
    ],
  },

  // ── Events & Venues ─────────────────────────────────────────────────
  {
    id: "event_booking_flow",
    name: { en: "Event Booking Flow", ar: "حجز فعالية" },
    description: {
      en: "Event booking: type, guest count, venue check, requirements, quote, confirmation",
      ar: "حجز فعالية: النوع، عدد الضيوف، التحقق من المكان، المتطلبات، عرض السعر، التأكيد",
    },
    category: "event",
    nodes: [
      { id: "start", type: "start", label: { en: "Start", ar: "بداية" } },
      {
        id: "greet",
        type: "prompt",
        label: { en: "Greeting", ar: "ترحيب" },
        prompt: "Greet the caller and ask about the event they are planning.",
      },
      {
        id: "event_type",
        type: "prompt",
        label: { en: "Event Type", ar: "نوع الفعالية" },
        prompt:
          "Ask about the type of event: wedding, corporate, birthday, conference, etc.",
      },
      {
        id: "guest_count",
        type: "prompt",
        label: { en: "Guest Count", ar: "عدد الضيوف" },
        prompt: "Ask for the expected number of guests and preferred date.",
      },
      {
        id: "check_venue",
        type: "tool_call",
        label: { en: "Check Venue", ar: "التحقق من المكان" },
        toolName: "check_venue_availability",
      },
      {
        id: "requirements",
        type: "prompt",
        label: { en: "Requirements", ar: "المتطلبات" },
        prompt:
          "Ask about additional requirements: catering, AV equipment, decorations, photography.",
      },
      {
        id: "quote",
        type: "tool_call",
        label: { en: "Generate Quote", ar: "إنشاء عرض سعر" },
        toolName: "generate_event_quote",
      },
      {
        id: "confirm",
        type: "prompt",
        label: { en: "Confirm Booking", ar: "تأكيد الحجز" },
        prompt:
          "Present the quote and confirm all event details with the caller.",
      },
      {
        id: "create_booking",
        type: "tool_call",
        label: { en: "Create Booking", ar: "إنشاء الحجز" },
        toolName: "create_event_booking",
      },
      {
        id: "farewell",
        type: "prompt",
        label: { en: "Goodbye", ar: "وداع" },
        prompt:
          "Thank the caller and confirm next steps for event preparation.",
      },
      { id: "end", type: "end", label: { en: "End", ar: "نهاية" } },
    ],
    edges: [
      { from: "start", to: "greet" },
      { from: "greet", to: "event_type" },
      { from: "event_type", to: "guest_count" },
      { from: "guest_count", to: "check_venue" },
      { from: "check_venue", to: "requirements", condition: "available" },
      {
        from: "check_venue",
        to: "guest_count",
        label: "Venue unavailable",
        condition: "unavailable",
      },
      { from: "requirements", to: "quote" },
      { from: "quote", to: "confirm" },
      { from: "confirm", to: "create_booking" },
      { from: "create_booking", to: "farewell" },
      { from: "farewell", to: "end" },
    ],
    customizationFields: [
      {
        key: "venue_types",
        label: { en: "Venue Types", ar: "أنواع الأماكن" },
        type: "text",
        defaultValue: "Ballroom, Garden, Conference Hall, Rooftop, Beach",
      },
      {
        key: "catering_options",
        label: { en: "Catering Options", ar: "خيارات التموين" },
        type: "text",
        defaultValue: "Buffet, Plated, Cocktail, Custom Menu",
      },
      {
        key: "max_capacity",
        label: { en: "Max Venue Capacity", ar: "السعة القصوى للمكان" },
        type: "text",
        defaultValue: "500",
      },
    ],
  },

  // ── Professional Services / Retail ──────────────────────────────────
  {
    id: "consultation_flow",
    name: { en: "Consultation Flow", ar: "حجز استشارة" },
    description: {
      en: "Professional consultation: identify need, match consultant, schedule, and confirm",
      ar: "استشارة مهنية: تحديد الحاجة، مطابقة المستشار، الجدولة، والتأكيد",
    },
    category: "consultation",
    nodes: [
      { id: "start", type: "start", label: { en: "Start", ar: "بداية" } },
      {
        id: "greet",
        type: "prompt",
        label: { en: "Greeting", ar: "ترحيب" },
        prompt:
          "Greet the caller and ask what type of consultation they need.",
      },
      {
        id: "identify_need",
        type: "prompt",
        label: { en: "Identify Need", ar: "تحديد الحاجة" },
        prompt:
          "Ask detailed questions to understand the caller's specific needs and situation.",
      },
      {
        id: "match_consultant",
        type: "tool_call",
        label: { en: "Match Consultant", ar: "مطابقة المستشار" },
        toolName: "match_consultant",
      },
      {
        id: "propose_times",
        type: "prompt",
        label: { en: "Propose Times", ar: "اقتراح المواعيد" },
        prompt:
          "Present available time slots for the matched consultant and ask for preference.",
      },
      {
        id: "case_details",
        type: "prompt",
        label: { en: "Collect Case Details", ar: "جمع تفاصيل الحالة" },
        prompt:
          "Collect any additional details or documents the consultant will need before the meeting.",
      },
      {
        id: "confirm",
        type: "prompt",
        label: { en: "Confirm Consultation", ar: "تأكيد الاستشارة" },
        prompt:
          "Confirm the consultant, time, and any preparation steps with the caller.",
      },
      {
        id: "create_booking",
        type: "tool_call",
        label: { en: "Create Booking", ar: "إنشاء الحجز" },
        toolName: "create_consultation_booking",
      },
      {
        id: "farewell",
        type: "prompt",
        label: { en: "Goodbye", ar: "وداع" },
        prompt:
          "Thank the caller and remind them of any preparation needed before the consultation.",
      },
      { id: "end", type: "end", label: { en: "End", ar: "نهاية" } },
    ],
    edges: [
      { from: "start", to: "greet" },
      { from: "greet", to: "identify_need" },
      { from: "identify_need", to: "match_consultant" },
      { from: "match_consultant", to: "propose_times" },
      { from: "propose_times", to: "case_details" },
      { from: "case_details", to: "confirm" },
      { from: "confirm", to: "create_booking" },
      { from: "create_booking", to: "farewell" },
      { from: "farewell", to: "end" },
    ],
    customizationFields: [
      {
        key: "consultation_types",
        label: { en: "Consultation Types", ar: "أنواع الاستشارات" },
        type: "text",
        defaultValue: "Legal, Financial, Tax, Business Strategy, HR",
      },
      {
        key: "consultant_specializations",
        label: { en: "Consultant Specializations", ar: "تخصصات المستشارين" },
        type: "text",
        defaultValue:
          "Corporate Law, Personal Finance, Investment, Startups, Employment Law",
      },
    ],
  },
];
