'use strict';
var formats = require('ajv/lib/compile/formats')();
var equal = require('ajv/lib/compile/equal');
var validate = (function() {
  var pattern0 = new RegExp('^(?!(indexing|.*-index|_.*)).*$');
  var pattern1 = new RegExp('^[0-9]{4}$');
  var pattern2 = new RegExp('^[0-9]{4}-[0-9]{2}-[0-9]{2}$');
  var pattern3 = new RegExp('^[0-9]{2}:[0-9]{2}$');
  var refVal = [];
  return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
    'use strict'; /*# sourceURL=https://formats.openag.io/oada/isoblue/can/v1.schema.json */
    var vErrors = null;
    var errors = 0;
    if (rootData === undefined) rootData = data;
    if ((data && typeof data === "object" && !Array.isArray(data))) {
      if (true) {
        var errs__0 = errors;
        var valid1 = true;
        var data1 = data.templates;
        if (data1 === undefined) {
          valid1 = true;
        } else {
          var errs_1 = errors;
          if ((data1 && typeof data1 === "object" && !Array.isArray(data1))) {
            var errs__1 = errors;
            var valid2 = true;
            for (var key1 in data1) {
              if (pattern0.test(key1)) {
                var data2 = data1[key1];
                var errs_2 = errors;
                if ((data2 && typeof data2 === "object" && !Array.isArray(data2))) {
                  var errs__2 = errors;
                  var valid3 = true;
                  if (data2.id === undefined) {
                    valid3 = true;
                  } else {
                    var errs_3 = errors;
                    if (typeof data2.id !== "string") {
                      validate.errors = [{
                        keyword: 'type',
                        dataPath: (dataPath || '') + '.templates[\'' + key1 + '\'].id',
                        schemaPath: '#/properties/templates/patternProperties/%5E(%3F!(indexing%7C.*-index%7C_.*)).*%24/properties/id/type',
                        params: {
                          type: 'string'
                        },
                        message: 'should be string'
                      }];
                      return false;
                    }
                    var valid3 = errors === errs_3;
                  }
                  if (valid3) {
                    var data3 = data2.time;
                    if (data3 === undefined) {
                      valid3 = true;
                    } else {
                      var errs_3 = errors;
                      if ((data3 && typeof data3 === "object" && !Array.isArray(data3))) {
                        var errs__3 = errors;
                        var valid4 = true;
                        if (data3.units === undefined) {
                          valid4 = true;
                        } else {
                          var errs_4 = errors;
                          if (typeof data3.units !== "string") {
                            validate.errors = [{
                              keyword: 'type',
                              dataPath: (dataPath || '') + '.templates[\'' + key1 + '\'].time.units',
                              schemaPath: '#/properties/templates/patternProperties/%5E(%3F!(indexing%7C.*-index%7C_.*)).*%24/properties/time/properties/units/type',
                              params: {
                                type: 'string'
                              },
                              message: 'should be string'
                            }];
                            return false;
                          }
                          var valid4 = errors === errs_4;
                        }
                        if (valid4) {}
                        if (errs__3 == errors) {}
                      } else {
                        validate.errors = [{
                          keyword: 'type',
                          dataPath: (dataPath || '') + '.templates[\'' + key1 + '\'].time',
                          schemaPath: '#/properties/templates/patternProperties/%5E(%3F!(indexing%7C.*-index%7C_.*)).*%24/properties/time/type',
                          params: {
                            type: 'object'
                          },
                          message: 'should be object'
                        }];
                        return false;
                      }
                      if (errors === errs_3) {}
                      var valid3 = errors === errs_3;
                    }
                    if (valid3) {
                      if (valid3) {
                        if (valid3) {
                          if (valid3) {
                            if (valid3) {
                              if (valid3) {
                                if (valid3) {}
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                  if (errs__2 == errors) {}
                } else {
                  validate.errors = [{
                    keyword: 'type',
                    dataPath: (dataPath || '') + '.templates[\'' + key1 + '\']',
                    schemaPath: '#/properties/templates/patternProperties/%5E(%3F!(indexing%7C.*-index%7C_.*)).*%24/type',
                    params: {
                      type: 'object'
                    },
                    message: 'should be object'
                  }];
                  return false;
                }
                if (errors === errs_2) {}
                var valid2 = errors === errs_2;
                if (!valid2) break;
              } else valid2 = true;
            }
            if (valid2) {}
            if (errs__1 == errors) {}
          }
          if (errors === errs_1) {}
          var valid1 = errors === errs_1;
        }
        if (valid1) {
          var data1 = data.data;
          if (data1 === undefined) {
            valid1 = true;
          } else {
            var errs_1 = errors;
            if ((data1 && typeof data1 === "object" && !Array.isArray(data1))) {
              var errs__1 = errors;
              var valid2 = true;
              for (var key1 in data1) {
                if (pattern0.test(key1)) {
                  var data2 = data1[key1];
                  var errs_2 = errors;
                  if ((data2 && typeof data2 === "object" && !Array.isArray(data2))) {
                    if (true) {
                      var errs__2 = errors;
                      var valid3 = true;
                      if (data2.id === undefined) {
                        valid3 = false;
                        validate.errors = [{
                          keyword: 'required',
                          dataPath: (dataPath || '') + '.data[\'' + key1 + '\']',
                          schemaPath: '#/properties/data/patternProperties/%5E(%3F!(indexing%7C.*-index%7C_.*)).*%24/required',
                          params: {
                            missingProperty: 'id'
                          },
                          message: 'should have required property \'id\''
                        }];
                        return false;
                      } else {
                        var errs_3 = errors;
                        if (typeof data2.id !== "string") {
                          validate.errors = [{
                            keyword: 'type',
                            dataPath: (dataPath || '') + '.data[\'' + key1 + '\'].id',
                            schemaPath: '#/properties/data/patternProperties/%5E(%3F!(indexing%7C.*-index%7C_.*)).*%24/properties/id/type',
                            params: {
                              type: 'string'
                            },
                            message: 'should be string'
                          }];
                          return false;
                        }
                        var valid3 = errors === errs_3;
                      }
                      if (valid3) {
                        var data3 = data2.time;
                        if (data3 === undefined) {
                          valid3 = false;
                          validate.errors = [{
                            keyword: 'required',
                            dataPath: (dataPath || '') + '.data[\'' + key1 + '\']',
                            schemaPath: '#/properties/data/patternProperties/%5E(%3F!(indexing%7C.*-index%7C_.*)).*%24/required',
                            params: {
                              missingProperty: 'time'
                            },
                            message: 'should have required property \'time\''
                          }];
                          return false;
                        } else {
                          var errs_3 = errors;
                          if ((data3 && typeof data3 === "object" && !Array.isArray(data3))) {
                            var errs__3 = errors;
                            var valid4 = true;
                            if (data3.units === undefined) {
                              valid4 = true;
                            } else {
                              var errs_4 = errors;
                              if (typeof data3.units !== "string") {
                                validate.errors = [{
                                  keyword: 'type',
                                  dataPath: (dataPath || '') + '.data[\'' + key1 + '\'].time.units',
                                  schemaPath: '#/properties/data/patternProperties/%5E(%3F!(indexing%7C.*-index%7C_.*)).*%24/properties/time/properties/units/type',
                                  params: {
                                    type: 'string'
                                  },
                                  message: 'should be string'
                                }];
                                return false;
                              }
                              var valid4 = errors === errs_4;
                            }
                            if (valid4) {}
                            if (errs__3 == errors) {}
                          } else {
                            validate.errors = [{
                              keyword: 'type',
                              dataPath: (dataPath || '') + '.data[\'' + key1 + '\'].time',
                              schemaPath: '#/properties/data/patternProperties/%5E(%3F!(indexing%7C.*-index%7C_.*)).*%24/properties/time/type',
                              params: {
                                type: 'object'
                              },
                              message: 'should be object'
                            }];
                            return false;
                          }
                          if (errors === errs_3) {}
                          var valid3 = errors === errs_3;
                        }
                        if (valid3) {
                          if (valid3) {
                            if (valid3) {
                              if (valid3) {
                                if (valid3) {
                                  if (valid3) {
                                    if (valid3) {}
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                      if (errs__2 == errors) {}
                    }
                  } else {
                    validate.errors = [{
                      keyword: 'type',
                      dataPath: (dataPath || '') + '.data[\'' + key1 + '\']',
                      schemaPath: '#/properties/data/patternProperties/%5E(%3F!(indexing%7C.*-index%7C_.*)).*%24/type',
                      params: {
                        type: 'object'
                      },
                      message: 'should be object'
                    }];
                    return false;
                  }
                  if (errors === errs_2) {}
                  var valid2 = errors === errs_2;
                  if (!valid2) break;
                } else valid2 = true;
              }
              if (valid2) {}
              if (errs__1 == errors) {}
            }
            if (errors === errs_1) {}
            var valid1 = errors === errs_1;
          }
          if (valid1) {
            if (data._id === undefined) {
              valid1 = true;
            } else {
              var errs_1 = errors;
              if (typeof data._id !== "string") {
                validate.errors = [{
                  keyword: 'type',
                  dataPath: (dataPath || '') + '._id',
                  schemaPath: '#/properties/_id/type',
                  params: {
                    type: 'string'
                  },
                  message: 'should be string'
                }];
                return false;
              }
              var valid1 = errors === errs_1;
            }
            if (valid1) {
              var data1 = data._rev;
              if (data1 === undefined) {
                valid1 = true;
              } else {
                var errs_1 = errors;
                if ((typeof data1 !== "number" || (data1 % 1) || data1 !== data1)) {
                  validate.errors = [{
                    keyword: 'type',
                    dataPath: (dataPath || '') + '._rev',
                    schemaPath: '#/properties/_rev/type',
                    params: {
                      type: 'integer'
                    },
                    message: 'should be integer'
                  }];
                  return false;
                }
                var valid1 = errors === errs_1;
              }
              if (valid1) {
                var data1 = data._meta;
                if (data1 === undefined) {
                  valid1 = true;
                } else {
                  var errs_1 = errors;
                  if ((data1 && typeof data1 === "object" && !Array.isArray(data1))) {
                    if (true) {
                      var errs__1 = errors;
                      var valid2 = true;
                      if (data1._id === undefined) {
                        valid2 = false;
                        validate.errors = [{
                          keyword: 'required',
                          dataPath: (dataPath || '') + '._meta',
                          schemaPath: '#/properties/_meta/required',
                          params: {
                            missingProperty: '_id'
                          },
                          message: 'should have required property \'_id\''
                        }];
                        return false;
                      } else {
                        var errs_2 = errors;
                        if (typeof data1._id !== "string") {
                          validate.errors = [{
                            keyword: 'type',
                            dataPath: (dataPath || '') + '._meta._id',
                            schemaPath: '#/properties/_meta/properties/_id/type',
                            params: {
                              type: 'string'
                            },
                            message: 'should be string'
                          }];
                          return false;
                        }
                        var valid2 = errors === errs_2;
                      }
                      if (valid2) {
                        var data2 = data1._rev;
                        if (data2 === undefined) {
                          valid2 = false;
                          validate.errors = [{
                            keyword: 'required',
                            dataPath: (dataPath || '') + '._meta',
                            schemaPath: '#/properties/_meta/required',
                            params: {
                              missingProperty: '_rev'
                            },
                            message: 'should have required property \'_rev\''
                          }];
                          return false;
                        } else {
                          var errs_2 = errors;
                          if ((typeof data2 !== "number" || (data2 % 1) || data2 !== data2)) {
                            validate.errors = [{
                              keyword: 'type',
                              dataPath: (dataPath || '') + '._meta._rev',
                              schemaPath: '#/properties/_meta/properties/_rev/type',
                              params: {
                                type: 'integer'
                              },
                              message: 'should be integer'
                            }];
                            return false;
                          }
                          var valid2 = errors === errs_2;
                        }
                        if (valid2) {}
                      }
                      if (errs__1 == errors) {}
                    }
                  } else {
                    validate.errors = [{
                      keyword: 'type',
                      dataPath: (dataPath || '') + '._meta',
                      schemaPath: '#/properties/_meta/type',
                      params: {
                        type: 'object'
                      },
                      message: 'should be object'
                    }];
                    return false;
                  }
                  if (errors === errs_1) {}
                  var valid1 = errors === errs_1;
                }
                if (valid1) {
                  if (data._type === undefined) {
                    valid1 = false;
                    validate.errors = [{
                      keyword: 'required',
                      dataPath: (dataPath || '') + "",
                      schemaPath: '#/required',
                      params: {
                        missingProperty: '_type'
                      },
                      message: 'should have required property \'_type\''
                    }];
                    return false;
                  } else {
                    var errs_1 = errors;
                    var schema1 = validate.schema.properties._type.enum;
                    var valid1;
                    valid1 = false;
                    for (var i1 = 0; i1 < schema1.length; i1++)
                      if (equal(data._type, schema1[i1])) {
                        valid1 = true;
                        break;
                      } if (!valid1) {
                      validate.errors = [{
                        keyword: 'enum',
                        dataPath: (dataPath || '') + '._type',
                        schemaPath: '#/properties/_type/enum',
                        params: {
                          allowedValues: schema1
                        },
                        message: 'should be equal to one of the allowed values'
                      }];
                      return false;
                    } else {}
                    if (errors === errs_1) {}
                    var valid1 = errors === errs_1;
                  }
                  if (valid1) {
                    var data1 = data.indexing;
                    if (data1 === undefined) {
                      valid1 = true;
                    } else {
                      var errs_1 = errors;
                      if (Array.isArray(data1)) {
                        var errs__1 = errors;
                        var valid1;
                        for (var i1 = 0; i1 < data1.length; i1++) {
                          var data2 = data1[i1];
                          var errs_2 = errors;
                          var errs__2 = errors;
                          var valid2 = false;
                          var errs_3 = errors;
                          if ((data2 && typeof data2 === "object" && !Array.isArray(data2))) {
                            var errs__3 = errors;
                            var valid4 = true;
                            if (data2.index === undefined) {
                              valid4 = true;
                            } else {
                              var errs_4 = errors;
                              var schema4 = validate.schema.properties.indexing.items.anyOf[0].properties.index.enum;
                              var valid4;
                              valid4 = false;
                              for (var i4 = 0; i4 < schema4.length; i4++)
                                if (equal(data2.index, schema4[i4])) {
                                  valid4 = true;
                                  break;
                                } if (!valid4) {
                                var err = {
                                  keyword: 'enum',
                                  dataPath: (dataPath || '') + '.indexing[' + i1 + '].index',
                                  schemaPath: '#/properties/indexing/items/anyOf/0/properties/index/enum',
                                  params: {
                                    allowedValues: schema4
                                  },
                                  message: 'should be equal to one of the allowed values'
                                };
                                if (vErrors === null) vErrors = [err];
                                else vErrors.push(err);
                                errors++;
                              } else {}
                              if (errors === errs_4) {}
                              var valid4 = errors === errs_4;
                            }
                            if (valid4) {
                              if (data2.source === undefined) {
                                valid4 = true;
                              } else {
                                var errs_4 = errors;
                                var schema4 = validate.schema.properties.indexing.items.anyOf[0].properties.source.enum;
                                var valid4;
                                valid4 = false;
                                for (var i4 = 0; i4 < schema4.length; i4++)
                                  if (equal(data2.source, schema4[i4])) {
                                    valid4 = true;
                                    break;
                                  } if (!valid4) {
                                  var err = {
                                    keyword: 'enum',
                                    dataPath: (dataPath || '') + '.indexing[' + i1 + '].source',
                                    schemaPath: '#/properties/indexing/items/anyOf/0/properties/source/enum',
                                    params: {
                                      allowedValues: schema4
                                    },
                                    message: 'should be equal to one of the allowed values'
                                  };
                                  if (vErrors === null) vErrors = [err];
                                  else vErrors.push(err);
                                  errors++;
                                } else {}
                                if (errors === errs_4) {}
                                var valid4 = errors === errs_4;
                              }
                              if (valid4) {
                                var data3 = data2.value;
                                if (data3 === undefined) {
                                  valid4 = true;
                                } else {
                                  var errs_4 = errors;
                                  if (typeof data3 === "string") {
                                    if (!pattern1.test(data3)) {
                                      var err = {
                                        keyword: 'pattern',
                                        dataPath: (dataPath || '') + '.indexing[' + i1 + '].value',
                                        schemaPath: '#/properties/indexing/items/anyOf/0/properties/value/pattern',
                                        params: {
                                          pattern: '^[0-9]{4}$'
                                        },
                                        message: 'should match pattern "^[0-9]{4}$"'
                                      };
                                      if (vErrors === null) vErrors = [err];
                                      else vErrors.push(err);
                                      errors++;
                                    } else {}
                                  } else {
                                    var err = {
                                      keyword: 'type',
                                      dataPath: (dataPath || '') + '.indexing[' + i1 + '].value',
                                      schemaPath: '#/properties/indexing/items/anyOf/0/properties/value/type',
                                      params: {
                                        type: 'string'
                                      },
                                      message: 'should be string'
                                    };
                                    if (vErrors === null) vErrors = [err];
                                    else vErrors.push(err);
                                    errors++;
                                  }
                                  if (errors === errs_4) {}
                                  var valid4 = errors === errs_4;
                                }
                                if (valid4) {}
                              }
                            }
                            if (errs__3 == errors) {}
                          } else {
                            var err = {
                              keyword: 'type',
                              dataPath: (dataPath || '') + '.indexing[' + i1 + ']',
                              schemaPath: '#/properties/indexing/items/anyOf/0/type',
                              params: {
                                type: 'object'
                              },
                              message: 'should be object'
                            };
                            if (vErrors === null) vErrors = [err];
                            else vErrors.push(err);
                            errors++;
                          }
                          if (errors === errs_3) {}
                          var valid3 = errors === errs_3;
                          valid2 = valid2 || valid3;
                          if (!valid2) {
                            var errs_3 = errors;
                            if ((data2 && typeof data2 === "object" && !Array.isArray(data2))) {
                              var errs__3 = errors;
                              var valid4 = true;
                              if (data2.index === undefined) {
                                valid4 = true;
                              } else {
                                var errs_4 = errors;
                                var schema4 = validate.schema.properties.indexing.items.anyOf[1].properties.index.enum;
                                var valid4;
                                valid4 = false;
                                for (var i4 = 0; i4 < schema4.length; i4++)
                                  if (equal(data2.index, schema4[i4])) {
                                    valid4 = true;
                                    break;
                                  } if (!valid4) {
                                  var err = {
                                    keyword: 'enum',
                                    dataPath: (dataPath || '') + '.indexing[' + i1 + '].index',
                                    schemaPath: '#/properties/indexing/items/anyOf/1/properties/index/enum',
                                    params: {
                                      allowedValues: schema4
                                    },
                                    message: 'should be equal to one of the allowed values'
                                  };
                                  if (vErrors === null) vErrors = [err];
                                  else vErrors.push(err);
                                  errors++;
                                } else {}
                                if (errors === errs_4) {}
                                var valid4 = errors === errs_4;
                              }
                              if (valid4) {
                                if (data2.source === undefined) {
                                  valid4 = true;
                                } else {
                                  var errs_4 = errors;
                                  var schema4 = validate.schema.properties.indexing.items.anyOf[1].properties.source.enum;
                                  var valid4;
                                  valid4 = false;
                                  for (var i4 = 0; i4 < schema4.length; i4++)
                                    if (equal(data2.source, schema4[i4])) {
                                      valid4 = true;
                                      break;
                                    } if (!valid4) {
                                    var err = {
                                      keyword: 'enum',
                                      dataPath: (dataPath || '') + '.indexing[' + i1 + '].source',
                                      schemaPath: '#/properties/indexing/items/anyOf/1/properties/source/enum',
                                      params: {
                                        allowedValues: schema4
                                      },
                                      message: 'should be equal to one of the allowed values'
                                    };
                                    if (vErrors === null) vErrors = [err];
                                    else vErrors.push(err);
                                    errors++;
                                  } else {}
                                  if (errors === errs_4) {}
                                  var valid4 = errors === errs_4;
                                }
                                if (valid4) {
                                  var data3 = data2.value;
                                  if (data3 === undefined) {
                                    valid4 = true;
                                  } else {
                                    var errs_4 = errors;
                                    if (typeof data3 === "string") {
                                      if (!pattern2.test(data3)) {
                                        var err = {
                                          keyword: 'pattern',
                                          dataPath: (dataPath || '') + '.indexing[' + i1 + '].value',
                                          schemaPath: '#/properties/indexing/items/anyOf/1/properties/value/pattern',
                                          params: {
                                            pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}$'
                                          },
                                          message: 'should match pattern "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"'
                                        };
                                        if (vErrors === null) vErrors = [err];
                                        else vErrors.push(err);
                                        errors++;
                                      } else {}
                                    } else {
                                      var err = {
                                        keyword: 'type',
                                        dataPath: (dataPath || '') + '.indexing[' + i1 + '].value',
                                        schemaPath: '#/properties/indexing/items/anyOf/1/properties/value/type',
                                        params: {
                                          type: 'string'
                                        },
                                        message: 'should be string'
                                      };
                                      if (vErrors === null) vErrors = [err];
                                      else vErrors.push(err);
                                      errors++;
                                    }
                                    if (errors === errs_4) {}
                                    var valid4 = errors === errs_4;
                                  }
                                  if (valid4) {}
                                }
                              }
                              if (errs__3 == errors) {}
                            } else {
                              var err = {
                                keyword: 'type',
                                dataPath: (dataPath || '') + '.indexing[' + i1 + ']',
                                schemaPath: '#/properties/indexing/items/anyOf/1/type',
                                params: {
                                  type: 'object'
                                },
                                message: 'should be object'
                              };
                              if (vErrors === null) vErrors = [err];
                              else vErrors.push(err);
                              errors++;
                            }
                            if (errors === errs_3) {}
                            var valid3 = errors === errs_3;
                            valid2 = valid2 || valid3;
                            if (!valid2) {
                              var errs_3 = errors;
                              if ((data2 && typeof data2 === "object" && !Array.isArray(data2))) {
                                var errs__3 = errors;
                                var valid4 = true;
                                if (data2.index === undefined) {
                                  valid4 = true;
                                } else {
                                  var errs_4 = errors;
                                  var schema4 = validate.schema.properties.indexing.items.anyOf[2].properties.index.enum;
                                  var valid4;
                                  valid4 = false;
                                  for (var i4 = 0; i4 < schema4.length; i4++)
                                    if (equal(data2.index, schema4[i4])) {
                                      valid4 = true;
                                      break;
                                    } if (!valid4) {
                                    var err = {
                                      keyword: 'enum',
                                      dataPath: (dataPath || '') + '.indexing[' + i1 + '].index',
                                      schemaPath: '#/properties/indexing/items/anyOf/2/properties/index/enum',
                                      params: {
                                        allowedValues: schema4
                                      },
                                      message: 'should be equal to one of the allowed values'
                                    };
                                    if (vErrors === null) vErrors = [err];
                                    else vErrors.push(err);
                                    errors++;
                                  } else {}
                                  if (errors === errs_4) {}
                                  var valid4 = errors === errs_4;
                                }
                                if (valid4) {
                                  if (data2.source === undefined) {
                                    valid4 = true;
                                  } else {
                                    var errs_4 = errors;
                                    var schema4 = validate.schema.properties.indexing.items.anyOf[2].properties.source.enum;
                                    var valid4;
                                    valid4 = false;
                                    for (var i4 = 0; i4 < schema4.length; i4++)
                                      if (equal(data2.source, schema4[i4])) {
                                        valid4 = true;
                                        break;
                                      } if (!valid4) {
                                      var err = {
                                        keyword: 'enum',
                                        dataPath: (dataPath || '') + '.indexing[' + i1 + '].source',
                                        schemaPath: '#/properties/indexing/items/anyOf/2/properties/source/enum',
                                        params: {
                                          allowedValues: schema4
                                        },
                                        message: 'should be equal to one of the allowed values'
                                      };
                                      if (vErrors === null) vErrors = [err];
                                      else vErrors.push(err);
                                      errors++;
                                    } else {}
                                    if (errors === errs_4) {}
                                    var valid4 = errors === errs_4;
                                  }
                                  if (valid4) {
                                    var data3 = data2.value;
                                    if (data3 === undefined) {
                                      valid4 = true;
                                    } else {
                                      var errs_4 = errors;
                                      if (typeof data3 === "string") {
                                        if (!pattern3.test(data3)) {
                                          var err = {
                                            keyword: 'pattern',
                                            dataPath: (dataPath || '') + '.indexing[' + i1 + '].value',
                                            schemaPath: '#/properties/indexing/items/anyOf/2/properties/value/pattern',
                                            params: {
                                              pattern: '^[0-9]{2}:[0-9]{2}$'
                                            },
                                            message: 'should match pattern "^[0-9]{2}:[0-9]{2}$"'
                                          };
                                          if (vErrors === null) vErrors = [err];
                                          else vErrors.push(err);
                                          errors++;
                                        } else {}
                                      } else {
                                        var err = {
                                          keyword: 'type',
                                          dataPath: (dataPath || '') + '.indexing[' + i1 + '].value',
                                          schemaPath: '#/properties/indexing/items/anyOf/2/properties/value/type',
                                          params: {
                                            type: 'string'
                                          },
                                          message: 'should be string'
                                        };
                                        if (vErrors === null) vErrors = [err];
                                        else vErrors.push(err);
                                        errors++;
                                      }
                                      if (errors === errs_4) {}
                                      var valid4 = errors === errs_4;
                                    }
                                    if (valid4) {}
                                  }
                                }
                                if (errs__3 == errors) {}
                              } else {
                                var err = {
                                  keyword: 'type',
                                  dataPath: (dataPath || '') + '.indexing[' + i1 + ']',
                                  schemaPath: '#/properties/indexing/items/anyOf/2/type',
                                  params: {
                                    type: 'object'
                                  },
                                  message: 'should be object'
                                };
                                if (vErrors === null) vErrors = [err];
                                else vErrors.push(err);
                                errors++;
                              }
                              if (errors === errs_3) {}
                              var valid3 = errors === errs_3;
                              valid2 = valid2 || valid3;
                              if (!valid2) {}
                            }
                          }
                          if (!valid2) {
                            var err = {
                              keyword: 'anyOf',
                              dataPath: (dataPath || '') + '.indexing[' + i1 + ']',
                              schemaPath: '#/properties/indexing/items/anyOf',
                              params: {},
                              message: 'should match some schema in anyOf'
                            };
                            if (vErrors === null) vErrors = [err];
                            else vErrors.push(err);
                            errors++;
                            validate.errors = vErrors;
                            return false;
                          } else {
                            errors = errs__2;
                            if (vErrors !== null) {
                              if (errs__2) vErrors.length = errs__2;
                              else vErrors = null;
                            }
                          }
                          if (errors === errs_2) {}
                          var valid2 = errors === errs_2;
                          if (!valid2) break;
                        }
                        if (errs__1 == errors) {}
                      } else {
                        validate.errors = [{
                          keyword: 'type',
                          dataPath: (dataPath || '') + '.indexing',
                          schemaPath: '#/properties/indexing/type',
                          params: {
                            type: 'array'
                          },
                          message: 'should be array'
                        }];
                        return false;
                      }
                      if (errors === errs_1) {}
                      var valid1 = errors === errs_1;
                    }
                    if (valid1) {
                      var data1 = data['year-index'];
                      if (data1 === undefined) {
                        valid1 = true;
                      } else {
                        var errs_1 = errors;
                        if ((data1 && typeof data1 === "object" && !Array.isArray(data1))) {
                          var errs__1 = errors;
                          var valid2 = true;
                          for (var key1 in data1) {
                            if (pattern1.test(key1)) {
                              var data2 = data1[key1];
                              var errs_2 = errors;
                              if ((data2 && typeof data2 === "object" && !Array.isArray(data2))) {
                                if (true) {
                                  var errs__2 = errors;
                                  var valid3 = true;
                                  if (data2._id === undefined) {
                                    valid3 = false;
                                    validate.errors = [{
                                      keyword: 'required',
                                      dataPath: (dataPath || '') + '[\'year-index\'][\'' + key1 + '\']',
                                      schemaPath: '#/properties/year-index/patternProperties/%5E%5B0-9%5D%7B4%7D%24/required',
                                      params: {
                                        missingProperty: '_id'
                                      },
                                      message: 'should have required property \'_id\''
                                    }];
                                    return false;
                                  } else {
                                    var errs_3 = errors;
                                    if (typeof data2._id !== "string") {
                                      validate.errors = [{
                                        keyword: 'type',
                                        dataPath: (dataPath || '') + '[\'year-index\'][\'' + key1 + '\']._id',
                                        schemaPath: '#/properties/year-index/patternProperties/%5E%5B0-9%5D%7B4%7D%24/properties/_id/type',
                                        params: {
                                          type: 'string'
                                        },
                                        message: 'should be string'
                                      }];
                                      return false;
                                    }
                                    var valid3 = errors === errs_3;
                                  }
                                  if (valid3) {}
                                  if (errs__2 == errors) {}
                                }
                              } else {
                                validate.errors = [{
                                  keyword: 'type',
                                  dataPath: (dataPath || '') + '[\'year-index\'][\'' + key1 + '\']',
                                  schemaPath: '#/properties/year-index/patternProperties/%5E%5B0-9%5D%7B4%7D%24/type',
                                  params: {
                                    type: 'object'
                                  },
                                  message: 'should be object'
                                }];
                                return false;
                              }
                              if (errors === errs_2) {}
                              var valid2 = errors === errs_2;
                              if (!valid2) break;
                            } else valid2 = true;
                          }
                          if (valid2) {}
                          if (errs__1 == errors) {}
                        }
                        if (errors === errs_1) {}
                        var valid1 = errors === errs_1;
                      }
                      if (valid1) {
                        var data1 = data['day-index'];
                        if (data1 === undefined) {
                          valid1 = true;
                        } else {
                          var errs_1 = errors;
                          if ((data1 && typeof data1 === "object" && !Array.isArray(data1))) {
                            var errs__1 = errors;
                            var valid2 = true;
                            for (var key1 in data1) {
                              if (pattern2.test(key1)) {
                                var data2 = data1[key1];
                                var errs_2 = errors;
                                if ((data2 && typeof data2 === "object" && !Array.isArray(data2))) {
                                  if (true) {
                                    var errs__2 = errors;
                                    var valid3 = true;
                                    if (data2._id === undefined) {
                                      valid3 = false;
                                      validate.errors = [{
                                        keyword: 'required',
                                        dataPath: (dataPath || '') + '[\'day-index\'][\'' + key1 + '\']',
                                        schemaPath: '#/properties/day-index/patternProperties/%5E%5B0-9%5D%7B4%7D-%5B0-9%5D%7B2%7D-%5B0-9%5D%7B2%7D%24/required',
                                        params: {
                                          missingProperty: '_id'
                                        },
                                        message: 'should have required property \'_id\''
                                      }];
                                      return false;
                                    } else {
                                      var errs_3 = errors;
                                      if (typeof data2._id !== "string") {
                                        validate.errors = [{
                                          keyword: 'type',
                                          dataPath: (dataPath || '') + '[\'day-index\'][\'' + key1 + '\']._id',
                                          schemaPath: '#/properties/day-index/patternProperties/%5E%5B0-9%5D%7B4%7D-%5B0-9%5D%7B2%7D-%5B0-9%5D%7B2%7D%24/properties/_id/type',
                                          params: {
                                            type: 'string'
                                          },
                                          message: 'should be string'
                                        }];
                                        return false;
                                      }
                                      var valid3 = errors === errs_3;
                                    }
                                    if (valid3) {}
                                    if (errs__2 == errors) {}
                                  }
                                } else {
                                  validate.errors = [{
                                    keyword: 'type',
                                    dataPath: (dataPath || '') + '[\'day-index\'][\'' + key1 + '\']',
                                    schemaPath: '#/properties/day-index/patternProperties/%5E%5B0-9%5D%7B4%7D-%5B0-9%5D%7B2%7D-%5B0-9%5D%7B2%7D%24/type',
                                    params: {
                                      type: 'object'
                                    },
                                    message: 'should be object'
                                  }];
                                  return false;
                                }
                                if (errors === errs_2) {}
                                var valid2 = errors === errs_2;
                                if (!valid2) break;
                              } else valid2 = true;
                            }
                            if (valid2) {}
                            if (errs__1 == errors) {}
                          }
                          if (errors === errs_1) {}
                          var valid1 = errors === errs_1;
                        }
                        if (valid1) {
                          var data1 = data['hour-index'];
                          if (data1 === undefined) {
                            valid1 = true;
                          } else {
                            var errs_1 = errors;
                            if ((data1 && typeof data1 === "object" && !Array.isArray(data1))) {
                              var errs__1 = errors;
                              var valid2 = true;
                              for (var key1 in data1) {
                                if (pattern3.test(key1)) {
                                  var data2 = data1[key1];
                                  var errs_2 = errors;
                                  if ((data2 && typeof data2 === "object" && !Array.isArray(data2))) {
                                    if (true) {
                                      var errs__2 = errors;
                                      var valid3 = true;
                                      if (data2._id === undefined) {
                                        valid3 = false;
                                        validate.errors = [{
                                          keyword: 'required',
                                          dataPath: (dataPath || '') + '[\'hour-index\'][\'' + key1 + '\']',
                                          schemaPath: '#/properties/hour-index/patternProperties/%5E%5B0-9%5D%7B2%7D%3A%5B0-9%5D%7B2%7D%24/required',
                                          params: {
                                            missingProperty: '_id'
                                          },
                                          message: 'should have required property \'_id\''
                                        }];
                                        return false;
                                      } else {
                                        var errs_3 = errors;
                                        if (typeof data2._id !== "string") {
                                          validate.errors = [{
                                            keyword: 'type',
                                            dataPath: (dataPath || '') + '[\'hour-index\'][\'' + key1 + '\']._id',
                                            schemaPath: '#/properties/hour-index/patternProperties/%5E%5B0-9%5D%7B2%7D%3A%5B0-9%5D%7B2%7D%24/properties/_id/type',
                                            params: {
                                              type: 'string'
                                            },
                                            message: 'should be string'
                                          }];
                                          return false;
                                        }
                                        var valid3 = errors === errs_3;
                                      }
                                      if (valid3) {}
                                      if (errs__2 == errors) {}
                                    }
                                  } else {
                                    validate.errors = [{
                                      keyword: 'type',
                                      dataPath: (dataPath || '') + '[\'hour-index\'][\'' + key1 + '\']',
                                      schemaPath: '#/properties/hour-index/patternProperties/%5E%5B0-9%5D%7B2%7D%3A%5B0-9%5D%7B2%7D%24/type',
                                      params: {
                                        type: 'object'
                                      },
                                      message: 'should be object'
                                    }];
                                    return false;
                                  }
                                  if (errors === errs_2) {}
                                  var valid2 = errors === errs_2;
                                  if (!valid2) break;
                                } else valid2 = true;
                              }
                              if (valid2) {}
                              if (errs__1 == errors) {}
                            }
                            if (errors === errs_1) {}
                            var valid1 = errors === errs_1;
                          }
                          if (valid1) {}
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
        if (errs__0 == errors) {}
      }
    } else {
      validate.errors = [{
        keyword: 'type',
        dataPath: (dataPath || '') + "",
        schemaPath: '#/type',
        params: {
          type: 'object'
        },
        message: 'should be object'
      }];
      return false;
    }
    if (errors === 0) {}
    validate.errors = vErrors;
    return errors === 0;
  };
})();
validate.schema = {
  "$id": "https://formats.openag.io/oada/isoblue/can/v1.schema.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "description": "CAN frame collected from machine attached to ISOBlue (or similar) device",
  "properties": {
    "templates": {
      "description": "templates is a general key for holding a collection of data points indexed by random strings.  Templates serve as prototypes for data points under \"data\" keys. If you have a piece of information that exists is all or almost all of the data points in a particular group of points, you can put the repeated things in templates and then just put the name of the template into the data point.  The full data point is therefore a merge of the template object and the data point itself, with the data point overruling when there are any keys that exist in both objects.  Schema is therefore identical to \"data\".",
      "patternProperties": {
        "^(?!(indexing|.*-index|_.*)).*$": {
          "description": "data-point never appears as a word in any document or URL.  It is a general type of object that can hold any type of data.  It represents the type of object that can sit under \"data\" or \"templates\".",
          "properties": {
            "id": {
              "description": "id (note this is NOT \"_id\") can be used to identify a particular data point, perhaps across documents which simply re-index the same data.",
              "type": "string"
            },
            "time": {
              "description": "time is a data type which holds a reading of...time...",
              "properties": {
                "units": {
                  "type": "string",
                  "examples": ["unix-timestamp", "sec"]
                }
              },
              "type": "object"
            },
            "is_error_frame": {
              "description": "Error frame flag for can frame"
            },
            "is_extended_frame": {
              "description": "Extended frame flag for can frame"
            },
            "arbitration_id": {
              "description": "CAN ID portion of extended can frame"
            },
            "dlc": {
              "description": "Data Length Code portion of extended can frame"
            },
            "payload": {
              "description": "String representation can frame payload in base64"
            },
            "is_remote_frame": {
              "description": "Remote frame flag from can frame"
            }
          },
          "type": "object"
        }
      }
    },
    "data": {
      "description": "data is a general key for holding a collection of data points indexed by random strings.",
      "patternProperties": {
        "^(?!(indexing|.*-index|_.*)).*$": {
          "description": "data-point never appears as a word in any document or URL.  It is a general type of object that can hold any type of data.  It represents the type of object that can sit under \"data\" or \"templates\".",
          "properties": {
            "id": {
              "description": "id (note this is NOT \"_id\") can be used to identify a particular data point, perhaps across documents which simply re-index the same data.",
              "type": "string"
            },
            "time": {
              "description": "time is a data type which holds a reading of...time...",
              "properties": {
                "units": {
                  "type": "string",
                  "examples": ["unix-timestamp", "sec"]
                }
              },
              "type": "object"
            },
            "is_error_frame": {
              "description": "Error frame flag for can frame"
            },
            "is_extended_frame": {
              "description": "Extended frame flag for can frame"
            },
            "arbitration_id": {
              "description": "CAN ID portion of extended can frame"
            },
            "dlc": {
              "description": "Data Length Code portion of extended can frame"
            },
            "payload": {
              "description": "String representation can frame payload in base64"
            },
            "is_remote_frame": {
              "description": "Remote frame flag from can frame"
            }
          },
          "required": ["id", "time"],
          "type": "object"
        }
      }
    },
    "_id": {
      "description": "_id identifies a resource in the OADA API.",
      "type": "string"
    },
    "_rev": {
      "description": "_rev is the revision string for a resource in the OADA API.",
      "type": "integer"
    },
    "_meta": {
      "description": "_meta is a link to the meta document for a resources.",
      "properties": {
        "_id": {
          "description": "_id identifies a resource in the OADA API.",
          "type": "string"
        },
        "_rev": {
          "description": "_rev is the revision string for a resource in the OADA API.",
          "type": "integer"
        }
      },
      "required": ["_id", "_rev"],
      "type": "object"
    },
    "_type": {
      "enum": ["application/vnd.oada.isoblue.can.1+json"]
    },
    "indexing": {
      "type": "array",
      "items": {
        "anyOf": [{
          "properties": {
            "index": {
              "enum": ["year-index"]
            },
            "source": {
              "enum": ["oada.vocab.year-index"]
            },
            "value": {
              "type": "string",
              "pattern": "^[0-9]{4}$"
            }
          },
          "type": "object"
        }, {
          "properties": {
            "index": {
              "enum": ["day-index"]
            },
            "source": {
              "enum": ["oada.vocab.day-index"]
            },
            "value": {
              "type": "string",
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
            }
          },
          "type": "object"
        }, {
          "properties": {
            "index": {
              "enum": ["hour-index"]
            },
            "source": {
              "enum": ["oada.vocab.hour-index"]
            },
            "value": {
              "type": "string",
              "pattern": "^[0-9]{2}:[0-9]{2}$"
            }
          },
          "type": "object"
        }]
      }
    },
    "year-index": {
      "description": "year-index splits things up by a 4-digit year",
      "patternProperties": {
        "^[0-9]{4}$": {
          "description": "A link in OADA has at least an _id key and links one resource to another.",
          "properties": {
            "_id": {
              "description": "_id identifies a resource in the OADA API.",
              "type": "string"
            }
          },
          "required": ["_id"],
          "type": "object"
        }
      }
    },
    "day-index": {
      "description": "day-index splits things up by days, with full year-month-day string for keys",
      "patternProperties": {
        "^[0-9]{4}-[0-9]{2}-[0-9]{2}$": {
          "description": "A link in OADA has at least an _id key and links one resource to another.",
          "properties": {
            "_id": {
              "description": "_id identifies a resource in the OADA API.",
              "type": "string"
            }
          },
          "required": ["_id"],
          "type": "object"
        }
      }
    },
    "hour-index": {
      "description": "hour-index splits things up by hours, 24-hour time string in GMT like 06:07 or 23:44",
      "patternProperties": {
        "^[0-9]{2}:[0-9]{2}$": {
          "description": "A link in OADA has at least an _id key and links one resource to another.",
          "properties": {
            "_id": {
              "description": "_id identifies a resource in the OADA API.",
              "type": "string"
            }
          },
          "required": ["_id"],
          "type": "object"
        }
      }
    }
  },
  "additionalProperties": true,
  "required": ["_type"],
  "type": "object",
  "examples": []
};
validate.errors = null;
module.exports = validate;