// Generated by ReScript, PLEASE EDIT WITH CARE
'use strict';

var Curry = require("bs-platform/lib/js/curry.js");
var Json_decode = require("@glennsl/bs-json/src/Json_decode.bs.js");
var ListH$OptolithClient = require("../../Data/ListH.bs.js");
var IntMap$OptolithClient = require("../../Data/IntMap.bs.js");
var Static_Erratum$OptolithClient = require("./Static_Erratum.bs.js");
var Static_SourceRef$OptolithClient = require("./Static_SourceRef.bs.js");

function type_(json) {
  return [
          Json_decode.field("id", Json_decode.$$int, json),
          Json_decode.field("name", Json_decode.string, json)
        ];
}

function domain(json) {
  return [
          Json_decode.field("id", Json_decode.$$int, json),
          Json_decode.field("name", Json_decode.string, json)
        ];
}

function t(json) {
  return {
          id: Json_decode.field("id", Json_decode.$$int, json),
          name: Json_decode.field("name", Json_decode.string, json),
          types: Curry._1(IntMap$OptolithClient.fromList, Json_decode.field("types", (function (param) {
                      return Json_decode.list(type_, param);
                    }), json)),
          domains: Curry._1(IntMap$OptolithClient.fromList, Json_decode.field("domains", (function (param) {
                      return Json_decode.list(domain, param);
                    }), json)),
          src: Json_decode.field("src", Static_SourceRef$OptolithClient.Decode.list, json),
          errata: Json_decode.field("errata", Static_Erratum$OptolithClient.Decode.list, json)
        };
}

function all(yamlData) {
  return Curry._1(IntMap$OptolithClient.fromList, ListH$OptolithClient.map((function (x) {
                    return [
                            x.id,
                            x
                          ];
                  }), Json_decode.list(t, yamlData.pactsL10n)));
}

var Decode = {
  type_: type_,
  domain: domain,
  t: t,
  all: all
};

exports.Decode = Decode;
/* IntMap-OptolithClient Not a pure module */
