import React from "react";
import { fn } from "@storybook/test";
import { HomePage } from "../components/HomePage";

export default {
  title: "Patterns/HomePage",
  component: HomePage,
  tags: ["autodocs"],
  parameters: {
    layout: "fullscreen",
    docs: {
      description: {
        component:
          "A full-screen landing experience that showcases toolkit items, smart AI solutions, client branding, latest updates, and quick configuration actions.",
      },
    },
  },
  argTypes: {
    clientName: {
      description:
        "Client name used to match and display logo on the right panel.",
      control: { type: "text" },
      table: { type: { summary: "string" }, defaultValue: { summary: "" } },
    },
    userName: {
      description: "User name displayed in the welcome heading.",
      control: { type: "text" },
      table: { type: { summary: "string" }, defaultValue: { summary: "" } },
    },
    toolKitItems: {
      description:
        "List of toolkit cards shown in the left panel. Each item supports: { name, description, url?, cta?, details?, folderContent? }.",
      control: { type: "object" },
      table: {
        type: { summary: "Array<Object>" },
        defaultValue: { summary: "[]" },
      },
    },
    smartAiItems: {
      description:
        "List of smart AI solution cards. Each item supports: { name, description, url?, cta?, details?, folderContent?, isNewProduct? }.",
      control: { type: "object" },
      table: {
        type: { summary: "Array<Object>" },
        defaultValue: { summary: "[]" },
      },
    },
    configurationsMenuItems: {
      description:
        "Items for the Configurations floating menu. Each item supports: { label, desc, logo }.",
      control: { type: "object" },
      table: {
        type: { summary: "Array<Object>" },
        defaultValue: { summary: "[]" },
      },
    },
    activeToolKitItem: {
      description:
        "Sets a toolkit item as expanded by default. Should reference one of toolKitItems.",
      control: { type: "object" },
      table: {
        type: { summary: "Object|null" },
        defaultValue: { summary: "null" },
      },
    },
    activeSmartAiItem: {
      description:
        "Sets a smart AI item as expanded by default. Should reference one of smartAiItems.",
      control: { type: "object" },
      table: {
        type: { summary: "Object|null" },
        defaultValue: { summary: "null" },
      },
    },
    onLaunchClick: {
      description: "Called when a toolkit item's Launch button is clicked.",
      table: {
        type: { summary: "function" },
        defaultValue: { summary: "() => {}" },
      },
    },
    onBookDemoClick: {
      description: "Called when a smart AI item's Book demo is clicked.",
      table: {
        type: { summary: "function" },
        defaultValue: { summary: "() => {}" },
      },
    },
    onViewReleasedNotesClick: {
      description:
        "Called when View released notes is clicked in Latest Updates.",
      table: {
        type: { summary: "function" },
        defaultValue: { summary: "() => {}" },
      },
    },
    onConfigurationsClick: {
      description: "Called when a configuration menu item is clicked.",
      table: {
        type: { summary: "function" },
        defaultValue: { summary: "() => {}" },
      },
    },
    onKnowMoreClick: {
      description:
        "Called when Know more is clicked in a smart AI expanded panel.",
      table: {
        type: { summary: "function" },
        defaultValue: { summary: "() => {}" },
      },
    },
  },
};

const Template = (args) => <HomePage {...args} />;

export const Default = Template.bind({});

Default.args = {
  clientName: "Balsamhill",
  userName: "Alex",
  toolKitItems: [
    {
      name: "Monday Smart",
      description: "AI-powered insights that make your data work smarter.",
      url: "https://example.com/monday-smart",
      cta: "Launch",
      details:
        "Discover and act on key metrics faster with AI-driven analysis and guided workflows.",
      folderContent: [
        "Quick Start Guide",
        "Performance Dashboards",
        "Data Connectors",
      ],
    },
    {
      name: "Inventory Smart",
      description:
        "Inventory intelligence and optimization for better availability.",
      url: "https://example.com/inventory-smart",
      cta: "Launch",
      details:
        "Reduce stockouts and overstocks using predictive insights and automated policies.",
      folderContent: ["Replenishment", "Allocation", "Markdown Planning"],
    },
    {
      name: "BaseSmart Restaurant",
      description:
        "Inventory intelligence and optimization for better availability.",
      url: "https://example.com/inventory-smart",
      cta: "Launch",
      details:
        "Reduce stockouts and overstocks using predictive insights and automated policies.",
      folderContent: ["Replenishment", "Allocation", "Markdown Planning"],
      releaseStatus: "Beta",
    },
  ],
  smartAiItems: [
    {
      name: "Smart Analytics",
      description: "Advanced analytics and business intelligence solutions.",
      url: "https://example.com/smart-analytics",
      cta: "Book demo",
      details:
        "Explore AI-powered BI, anomaly detection, and automated insights.",
      folderContent: [
        "AI-Powered Data Insights",
        "Anomaly Detection",
        "Narratives",
      ],
      isNewProduct: true,
    },
    {
      name: "Agent Assist",
      description:
        "Enable support teams with accurate, contextual answers instantly.",
      url: "https://example.com/agent-assist",
      cta: "Book demo",
      details:
        "Boost resolution speed with retrieval-augmented responses and guidance.",
      folderContent: ["Playbooks", "Macros", "Knowledge Base"],
      isNewProduct: false,
      releaseStatus: "Beta",
    },
  ],
  configurationsMenuItems: [
    {
      label: "User settings",
      desc: "Manage profile & preferences",
      logo: "⚙️",
    },
    { label: "Help & docs", desc: "Guides and tutorials", logo: "📘" },
  ],
  activeToolKitItem: null,
  activeSmartAiItem: null,
  onLaunchClick: fn(),
  onBookDemoClick: fn(),
  onViewReleasedNotesClick: fn(),
  onConfigurationsClick: fn(),
  onKnowMoreClick: fn(),
};
