import { createContext, useContext } from "react";

import type { components } from "../api/schema";

export type ConfigView = components["schemas"]["ConfigView"];

export const DEFAULTS: ConfigView = {
  app_name: "Collection Management System",
  default_language: "sv",
  default_timezone: "Europe/Stockholm",
};

export const ConfigContext = createContext<ConfigView>(DEFAULTS);

export function useConfig(): ConfigView {
  return useContext(ConfigContext);
}
