<script>
import {authenticatedRequest} from "@/components/session/authenticatedRequest.vue";
import {handleEconomicError} from "@/components/request/HandleEconomicError.vue";

/**
 * The Economic -> Config object
 */
export const Config = {
    get: async ( variable ) => {
      return authenticatedRequest(
          "/economic/config?variable=" + variable,
          "GET")
    },
    get_all: async () => {
      return authenticatedRequest(
          "/economic/config",
          "GET")
    },
    set: async ( variable, value ) => {
      return authenticatedRequest(
          "/economic/config",
          "POST",
          {
            variable: variable,
            value: value
          })
    },
    layouts: {
      invoiceLayoutNumber: {
        get: async () => {
          return Config.get("invoiceLayoutNumber");
        },
        set: async (layout) => {
          return Config.set("invoiceLayoutNumber", layout);
        },
      },
  },
};

</script>