import * as React from "react";

export interface KeyValuePair {
  key: string;
  value: string;
}

export interface ThemeOptions {
  filterBoxBackgroundColor?: string;
  filterBoxTextColor?: string;
  tableHeaderBackgroundColor?: string;
  tableHeaderTextColor?: string;

  addButtonBackgroundColor?: string;
  addButtonTextColor?: string;
  deleteButtonBackgroundColor?: string;
  deleteButtonColor?: string;
}

export interface ContextOptions {
  baseUrl: string;
  tokenResolver: () => string;
  additionalQueryParamsResolver?: () => KeyValuePair[];
  additionalHeadersResolver?: () => KeyValuePair[];
  theme?: string | ThemeOptions;
}

const ctx = React.createContext<ContextOptions | null>(null);

export const ContextProvider = ctx.Provider;

export const ContextConsumer = ctx.Consumer;
