export const PROVIDERS = ["openai", "anthropic", "xai", "gemini", "hermes-agent"] as const;

export type Provider = (typeof PROVIDERS)[number];

export type ChatImageAttachment = {
  kind: "image";
  id: string;
  filename: string;
  mimeType: "image/png" | "image/jpeg";
  sizeBytes: number;
  dataUrl: string;
};

export type ChatTextAttachment = {
  kind: "text";
  id: string;
  filename: string;
  mimeType: string;
  sizeBytes: number;
  text: string;
  truncated?: boolean;
};

export type ChatAttachment = ChatImageAttachment | ChatTextAttachment;

export type ChatMessage = {
  role: "system" | "user" | "assistant" | "tool";
  content: string;
  name?: string;
  attachments?: ChatAttachment[];
};

export type MultiplexRequest = {
  chatId?: string;
  persist?: boolean;
  clientRequestId?: string;
  provider: Provider;
  model: string;
  messages: ChatMessage[];
  additionalSystemPrompt?: string;
  enabledTools?: string[];
  userLocation?: string;
  temperature?: number;
  maxTokens?: number;
};

export type MultiplexResponse = {
  provider: Provider;
  model: string;
  message: { role: "assistant"; content: string };
  usage?: {
    inputTokens?: number;
    outputTokens?: number;
    totalTokens?: number;
  };
  raw: unknown;
};
