import { z } from 'zod';

/**
 * Inbound user message from any channel
 */
export const InboundMessageSchema = z.object({
  messageId: z.string(),
  userId: z.string(),
  sessionId: z.string(),
  content: z.string(),
  attachments: z.array(z.object({
    type: z.enum(['image', 'file', 'url']),
    url: z.string(),
    mimeType: z.string().optional(),
  })).optional(),
  timestamp: z.date(),
});

export type InboundMessage = z.infer<typeof InboundMessageSchema>;

/**
 * Outbound response to channel
 */
export const OutboundMessageSchema = z.object({
  messageId: z.string(),
  sessionId: z.string(),
  content: z.string(),
  attachments: z.array(z.object({
    type: z.enum(['image', 'chart', 'file']),
    url: z.string(),
    caption: z.string().optional(),
  })).optional(),
  metadata: z.record(z.unknown()).optional(),
  timestamp: z.date(),
});

export type OutboundMessage = z.infer<typeof OutboundMessageSchema>;
