import { SuggestionCategory } from '@spiffy-ai/commerce-api-client';
import { Message, MessageRole, MessageType, Suggestion } from 'src/application/models';
import { MockSalesAgentData } from 'src/contexts/salesAgentContext/salesAgentContext';

export const mockMessages: Message[][] = [
  // Welcome message
  [
    {
      id: 'welcome-msg-1',
      role: MessageRole.Assistant,
      type: MessageType.Text,
      createdAt: new Date(Date.now() - 310000).toISOString(),
      metadata: {
        content: 'Hello! How can I assist you today?',
      },
    },
  ],
  // User message
  [
    {
      id: 'user-msg-1',
      role: MessageRole.User,
      type: MessageType.QueryTyped,
      createdAt: new Date(Date.now() - 300000).toISOString(),
      metadata: {
        content: 'What are your best products?',
      },
    },
  ],

  // Assistant text response
  [
    {
      id: 'agent-msg-1',
      role: MessageRole.Assistant,
      type: MessageType.Text,
      createdAt: new Date(Date.now() - 290000).toISOString(),
      metadata: {
        content: 'Here are some of our best-selling products that customers love!',
      },
    },
  ],
  // Product carousel
  [
    {
      id: 'product-1',
      role: MessageRole.Assistant,
      type: MessageType.Product,
      createdAt: new Date(Date.now() - 280000).toISOString(),
      metadata: {
        id: 'product-1',
        title: 'Leather Tote Bag',
        salePrice: 89.99,
        originalPrice: 129.99,
        averageRating: 4.7,
        numberReviews: 127,
        url: 'https://example.com/product/leather-tote',
        imageUrl: 'https://picsum.photos/400/400?random=1',
        isForGrid: false,
      },
    },
    {
      id: 'product-2',
      role: MessageRole.Assistant,
      type: MessageType.Product,
      createdAt: new Date(Date.now() - 280000).toISOString(),
      metadata: {
        id: 'product-2',
        title: 'Designer Handbag',
        salePrice: 199.99,
        originalPrice: 249.99,
        averageRating: 4.5,
        numberReviews: 89,
        url: 'https://example.com/product/designer-handbag',
        imageUrl: 'https://picsum.photos/400/400?random=2',
        isForGrid: false,
      },
    },
    {
      id: 'product-3',
      role: MessageRole.Assistant,
      type: MessageType.Product,
      createdAt: new Date(Date.now() - 280000).toISOString(),
      metadata: {
        id: 'product-3',
        title: 'Classic Shoulder Bag',
        salePrice: 125.0,
        originalPrice: 150.0,
        averageRating: 4.8,
        numberReviews: 203,
        url: 'https://example.com/product/shoulder-bag',
        imageUrl: 'https://picsum.photos/400/400?random=3',
        isForGrid: false,
      },
    },
  ],
  // User message asking about reviews
  [
    {
      id: 'user-msg-2',
      role: MessageRole.User,
      type: MessageType.QueryTyped,
      createdAt: new Date(Date.now() - 200000).toISOString(),
      metadata: {
        content: 'What do customers say about these products?',
      },
    },
  ],
  // Assistant text response
  [
    {
      id: 'agent-msg-2',
      role: MessageRole.Assistant,
      type: MessageType.Text,
      createdAt: new Date(Date.now() - 190000).toISOString(),
      metadata: {
        content: 'Here are some recent customer reviews:',
      },
    },
  ],
  // Review carousel
  [
    {
      id: 'review-1',
      role: MessageRole.Assistant,
      type: MessageType.Review,
      createdAt: new Date(Date.now() - 180000).toISOString(),
      metadata: {
        id: 'review-1',
        productId: 'product-1',
        reviewer: 'Sarah M.',
        review:
          'Absolutely love this bag! The quality is outstanding and it fits everything I need. Highly recommend!',
        stars: 5,
      },
    },
    {
      id: 'review-2',
      role: MessageRole.Assistant,
      type: MessageType.Review,
      createdAt: new Date(Date.now() - 180000).toISOString(),
      metadata: {
        id: 'review-2',
        productId: 'product-2',
        reviewer: 'Jessica K.',
        review:
          'Beautiful design and great craftsmanship. The leather feels premium and the bag is very spacious.',
        stars: 5,
      },
    },
    {
      id: 'review-3',
      role: MessageRole.Assistant,
      type: MessageType.Review,
      createdAt: new Date(Date.now() - 180000).toISOString(),
      metadata: {
        id: 'review-3',
        productId: 'product-3',
        reviewer: 'Emily R.',
        review: 'Perfect size and style. I get compliments every time I use it. Worth every penny!',
        stars: 5,
      },
    },
  ],
  // User message asking about help pages
  [
    {
      id: 'user-msg-3',
      role: MessageRole.User,
      type: MessageType.QueryTyped,
      createdAt: new Date(Date.now() - 100000).toISOString(),
      metadata: {
        content: 'How do I return an item?',
      },
    },
  ],
  // Assistant text response with link
  [
    {
      id: 'agent-msg-3',
      role: MessageRole.Assistant,
      type: MessageType.Text,
      createdAt: new Date(Date.now() - 90000).toISOString(),
      metadata: {
        content:
          'You can return items within 30 days of purchase. Visit our returns page at [returns](https://example.com/returns) for more information.',
      },
    },
  ],
  // Page/document carousel
  [
    {
      id: 'page-1',
      role: MessageRole.Assistant,
      type: MessageType.Page,
      createdAt: new Date(Date.now() - 80000).toISOString(),
      metadata: {
        id: 'page-1',
        title: 'Return Policy',
        description:
          'Learn about our return policy, including timeframes, conditions, and how to initiate a return.',
        url: 'https://example.com/returns',
      },
    },
    {
      id: 'page-2',
      role: MessageRole.Assistant,
      type: MessageType.Page,
      createdAt: new Date(Date.now() - 80000).toISOString(),
      metadata: {
        id: 'page-2',
        title: 'Shipping Information',
        description: 'Find out about shipping options, delivery times, and tracking your order.',
        url: 'https://example.com/shipping',
      },
    },
  ],
];

export const mockSuggestions: Suggestion[] = [
  {
    id: 'suggestion-1',
    category: SuggestionCategory.ProductBased,
    content: 'What are the best products for gifting?',
    createdAt: new Date().toISOString(),
    isAnswer: false,
  },
  {
    id: 'suggestion-2',
    category: SuggestionCategory.ProductBased,
    content: 'Show me summer dresses',
    createdAt: new Date().toISOString(),
    isAnswer: false,
  },
  {
    id: 'suggestion-3',
    category: SuggestionCategory.ProductBased,
    content: 'Do you have free shipping?',
    createdAt: new Date().toISOString(),
    isAnswer: false,
  },
];

export const mockSalesAgentData: MockSalesAgentData = {
  messages: mockMessages,
  suggestions: mockSuggestions,
};
