'use strict';
var formats = require('ajv/lib/compile/formats')();
var validate = (function() {
  var pattern0 = new RegExp('^resources/.*$');
  var refVal = [];
  var refVal1 = {
    "description": "_id identifies a resource in the OADA API.",
    "type": "string",
    "pattern": "^resources/.*$"
  };
  refVal[1] = refVal1;
  return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
    'use strict'; /*# sourceURL=https://formats.openag.io/oada/service/jobs.schema.json */
    var vErrors = null;
    var errors = 0;
    if (rootData === undefined) rootData = data;
    if ((data && typeof data === "object" && !Array.isArray(data))) {
      var errs__0 = errors;
      var valid1 = true;
      for (var key0 in data) {
        var data1 = data[key0];
        var errs_1 = errors;
        if ((data1 && typeof data1 === "object" && !Array.isArray(data1))) {
          if (true) {
            var errs__1 = errors;
            var valid2 = true;
            var data2 = data1._id;
            if (data2 === undefined) {
              valid2 = false;
              validate.errors = [{
                keyword: 'required',
                dataPath: (dataPath || '') + '[\'' + key0 + '\']',
                schemaPath: '#/additionalProperties/required',
                params: {
                  missingProperty: '_id'
                },
                message: 'should have required property \'_id\''
              }];
              return false;
            } else {
              var errs_2 = errors;
              var errs_3 = errors;
              if (typeof data2 === "string") {
                if (!pattern0.test(data2)) {
                  validate.errors = [{
                    keyword: 'pattern',
                    dataPath: (dataPath || '') + '[\'' + key0 + '\']._id',
                    schemaPath: '../../oada.schema.json#/definitions/_id/pattern',
                    params: {
                      pattern: '^resources/.*$'
                    },
                    message: 'should match pattern "^resources/.*$"'
                  }];
                  return false;
                } else {}
              } else {
                validate.errors = [{
                  keyword: 'type',
                  dataPath: (dataPath || '') + '[\'' + key0 + '\']._id',
                  schemaPath: '../../oada.schema.json#/definitions/_id/type',
                  params: {
                    type: 'string'
                  },
                  message: 'should be string'
                }];
                return false;
              }
              if (errors === errs_3) {}
              var valid3 = errors === errs_3;
              if (valid3) {}
              if (errors === errs_2) {}
              var valid2 = errors === errs_2;
            }
            if (valid2) {}
            if (errs__1 == errors) {}
          }
        } else {
          validate.errors = [{
            keyword: 'type',
            dataPath: (dataPath || '') + '[\'' + key0 + '\']',
            schemaPath: '#/additionalProperties/type',
            params: {
              type: 'object'
            },
            message: 'should be object'
          }];
          return false;
        }
        if (errors === errs_1) {}
        var valid1 = errors === errs_1;
        if (!valid1) break;
      }
      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/service/jobs.schema.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "description": "The format for @oada/jobs jobs list",
  "type": "object",
  "additionalProperties": {
    "type": "object",
    "properties": {
      "_id": {
        "$ref": "../../oada.schema.json#/definitions/_id"
      }
    },
    "required": ["_id"]
  },
  "examples": [{
    "asdxjkacsdj": {
      "_id": "resources/ajajkjfsdaf",
      "_rev": 1
    }
  }]
};
validate.errors = null;
module.exports = validate;