import type { ArchetypeDefinition } from "../types";

const INQUIRY_BASE_FIELDS = [
  { name: "name", label: "Full name", type: "text" as const, required: true },
  { name: "email", label: "Email", type: "email" as const, required: true },
  { name: "phone", label: "Phone", type: "tel" as const, required: true },
];

const TRADES_FORM_FIELDS = [
  ...INQUIRY_BASE_FIELDS,
  { name: "jobType", label: "Job description", type: "text" as const, required: true },
  { name: "urgency", label: "Urgency", type: "select" as const, required: true, options: ["Emergency", "Routine", "Planned"] },
  { name: "propertyType", label: "Property type", type: "select" as const, required: true, options: ["Residential", "Commercial", "Industrial"] },
  { name: "notes", label: "Additional details", type: "textarea" as const, required: false },
];

export const tradesMaintenanceArchetypes: ArchetypeDefinition[] = [
  {
    archetypeId: "facilities-maintenance",
    name: "Facilities Maintenance",
    category: "trades-maintenance",
    ctaType: "inquiry",
    tags: ["facilities", "maintenance", "commercial", "repair"],
    itemTemplates: [
      { name: "Planned Maintenance Contract", description: "Regular scheduled maintenance visits", priceType: "quote" },
      { name: "Reactive Repair", description: "On-call repair service for unexpected faults", priceType: "from" },
      { name: "Building Inspection", description: "Full building condition survey and report", priceType: "quote" },
      { name: "HVAC Servicing", description: "Heating, ventilation, and air conditioning maintenance", priceType: "from" },
      { name: "Electrical Testing", description: "PAT testing and electrical safety inspection", priceType: "from" },
      { name: "Emergency Call-Out", description: "24/7 emergency response service", priceType: "from" },
    ],
    sectionTemplates: [
      { type: "hero", title: "Hero", sortOrder: 0 },
      { type: "items", title: "Services", sortOrder: 1 },
      { type: "about", title: "About Us", sortOrder: 2 },
      { type: "testimonials", title: "Client Feedback", sortOrder: 3 },
      { type: "contact", title: "Request a Quote", sortOrder: 4 },
    ],
    formSchema: TRADES_FORM_FIELDS,
  },
  {
    archetypeId: "plumber",
    name: "Plumber",
    category: "trades-maintenance",
    ctaType: "inquiry",
    tags: ["plumbing", "trades", "repair", "emergency"],
    itemTemplates: [
      { name: "Emergency Call-Out", description: "Fast response for burst pipes, leaks, and blockages", priceType: "from" },
      { name: "Boiler Service", description: "Annual boiler inspection and service", priceType: "fixed" },
      { name: "Boiler Repair", description: "Diagnosis and repair of boiler faults", priceType: "from" },
      { name: "Bathroom Installation", description: "Full bathroom suite fitting", priceType: "quote" },
      { name: "Drain Unblocking", description: "Clearing blocked drains and toilets", priceType: "from" },
      { name: "Leak Detection & Repair", description: "Locate and fix water leaks", priceType: "from" },
    ],
    sectionTemplates: [
      { type: "hero", title: "Hero", sortOrder: 0 },
      { type: "items", title: "Services", sortOrder: 1 },
      { type: "about", title: "About Us", sortOrder: 2 },
      { type: "contact", title: "Get a Quote", sortOrder: 3 },
    ],
    formSchema: TRADES_FORM_FIELDS,
  },
  {
    archetypeId: "electrician",
    name: "Electrician",
    category: "trades-maintenance",
    ctaType: "inquiry",
    tags: ["electrical", "trades", "wiring", "installation"],
    itemTemplates: [
      { name: "Electrical Safety Certificate", description: "EICR inspection and certification", priceType: "from" },
      { name: "Consumer Unit Replacement", description: "Upgrade your fuse box to modern standards", priceType: "from" },
      { name: "Socket & Switch Installation", description: "Adding or replacing sockets and switches", priceType: "from" },
      { name: "Lighting Installation", description: "Internal and external lighting fitting", priceType: "from" },
      { name: "EV Charger Installation", description: "Home electric vehicle charging point", priceType: "from" },
      { name: "Emergency Call-Out", description: "24/7 emergency electrical fault response", priceType: "from" },
    ],
    sectionTemplates: [
      { type: "hero", title: "Hero", sortOrder: 0 },
      { type: "items", title: "Services", sortOrder: 1 },
      { type: "about", title: "About Us", sortOrder: 2 },
      { type: "testimonials", title: "Customer Reviews", sortOrder: 3 },
      { type: "contact", title: "Get a Quote", sortOrder: 4 },
    ],
    formSchema: TRADES_FORM_FIELDS,
  },
  {
    archetypeId: "cleaning-service",
    name: "Cleaning Service",
    category: "trades-maintenance",
    ctaType: "inquiry",
    tags: ["cleaning", "domestic", "commercial", "maintenance"],
    itemTemplates: [
      { name: "Regular Domestic Clean", description: "Weekly or fortnightly home cleaning", priceType: "per-hour" },
      { name: "One-Off Deep Clean", description: "Thorough top-to-bottom clean", priceType: "quote" },
      { name: "End of Tenancy Clean", description: "Full professional clean for rental properties", priceType: "from" },
      { name: "Office Cleaning", description: "Flexible commercial office cleaning contract", priceType: "quote" },
      { name: "Carpet & Upholstery Clean", description: "Professional steam cleaning", priceType: "from" },
      { name: "Window Cleaning", description: "Internal and external window cleaning", priceType: "from" },
    ],
    sectionTemplates: [
      { type: "hero", title: "Hero", sortOrder: 0 },
      { type: "items", title: "Services", sortOrder: 1 },
      { type: "about", title: "About Us", sortOrder: 2 },
      { type: "testimonials", title: "What Clients Say", sortOrder: 3 },
      { type: "contact", title: "Get a Quote", sortOrder: 4 },
    ],
    formSchema: [
      ...INQUIRY_BASE_FIELDS,
      { name: "jobType", label: "Type of clean", type: "select" as const, required: true, options: ["Regular domestic", "One-off deep clean", "End of tenancy", "Office", "Carpet cleaning", "Window cleaning"] },
      { name: "propertyType", label: "Property type", type: "select" as const, required: true, options: ["Residential", "Commercial", "Industrial"] },
      { name: "frequency", label: "Frequency", type: "select" as const, required: false, options: ["One-off", "Weekly", "Fortnightly", "Monthly"] },
      { name: "notes", label: "Additional details", type: "textarea" as const, required: false },
    ],
  },
  {
    archetypeId: "landscaping",
    name: "Landscaping & Grounds",
    category: "trades-maintenance",
    ctaType: "inquiry",
    tags: ["landscaping", "garden", "grounds", "outdoor"],
    itemTemplates: [
      { name: "Garden Design Consultation", description: "On-site design meeting and concept plan", priceType: "fixed" },
      { name: "Lawn Maintenance Contract", description: "Regular lawn cutting and edging", priceType: "from" },
      { name: "Patio & Decking Installation", description: "Design and build outdoor living spaces", priceType: "quote" },
      { name: "Fencing & Gates", description: "Supply and installation of fencing and gates", priceType: "from" },
      { name: "Tree Surgery", description: "Tree pruning, felling, and stump removal", priceType: "quote" },
      { name: "Irrigation Systems", description: "Automated watering system design and installation", priceType: "quote" },
    ],
    sectionTemplates: [
      { type: "hero", title: "Hero", sortOrder: 0 },
      { type: "items", title: "Services", sortOrder: 1 },
      { type: "gallery", title: "Our Projects", sortOrder: 2 },
      { type: "about", title: "About Us", sortOrder: 3 },
      { type: "contact", title: "Request a Quote", sortOrder: 4 },
    ],
    formSchema: [
      ...INQUIRY_BASE_FIELDS,
      { name: "jobType", label: "Type of work", type: "text" as const, required: true },
      { name: "urgency", label: "Urgency", type: "select" as const, required: true, options: ["Emergency", "Routine", "Planned"] },
      { name: "propertyType", label: "Property type", type: "select" as const, required: true, options: ["Residential", "Commercial", "Industrial"] },
      { name: "gardenSize", label: "Garden size", type: "select" as const, required: false, options: ["Small (under 50m²)", "Medium (50–200m²)", "Large (200m²+)"] },
      { name: "notes", label: "Additional details", type: "textarea" as const, required: false },
    ],
  },
];
