import { createContext } from "react";

export interface ChatbotProps {
  color?: string;
  base_url: string;
  wallpaper?: string;
  owner_name?: string;
  initial_message?: string;
  whatsapp_number: string;
  background_color?: string;
}

export interface HeaderProps {
  color?: string;
  backgroundColor?: string;
  onClose?: () => void;
}

export interface BodyProps {
  color?: string;
  baseUrl: string;
  ownerName?: string;
  whatsappNumber: string;
  backgroundColor?: string;
}

export interface PopoverProps {
  color?: string;
  baseUrl: string;
  onClose: () => void;
  ownerName?: string;
  wallpaper?: string;
  whatsappNumber: string;
  backgroundColor?: string;
}

export interface messagesInterface {
  id: number;
  text: string;
  user: string;
}

type ContextProps = {
  step: number;
  userName: string;
  chatState: boolean;
  containerRef: HTMLDivElement | null;

  deviceModel: string;
  deviceCompany: string;
  deviceProblem: string;
  otherMessagesText: string;

  inputValue: string;
  firstOptionSelected: number;
  othersOptionSelected: number;
  deviceCompanyOptionSelected: number;

  lastMessages: messagesInterface;
  otherMessages: messagesInterface[];
  initialMessages: messagesInterface[];
  technicalAssitanceMessages: messagesInterface[];

  handleBackStep: () => void;

  handleSelectFirstOptions: (id: number) => void;
  handleSelectOthersOptions: (id: number) => void;
  handleSelectDeviceCompanyOptions: (id: number, company: string) => void;

  handleChangeStep: (step: number) => void;
  handleChangeUserName: (userName: string) => void;
  handleChangeDeviceModel: (deviceModel: string) => void;
  handleChangeInputValue: (inputValue: string) => void;
  handleChangeDeviceCompany: (deviceCompany: string) => void;
  handleChangeDeviceProblem: (deviceProblem: string) => void;
  handleChangeOtherMessagesText: (otherMessagesText: string) => void;

  handleGetContainerRef: (ref: HTMLDivElement) => void;

  handleSetChatState: (chatState: boolean) => void;
};

export const Context = createContext({} as ContextProps);
