'use strict';
var formats = require('ajv/lib/compile/formats')();
var validate = (function() {
  var refVal = [];
  return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
    'use strict'; /*# sourceURL=https://formats.openag.io/oada/service/job/update.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;
        if (data.status === undefined) {
          valid1 = false;
          validate.errors = [{
            keyword: 'required',
            dataPath: (dataPath || '') + "",
            schemaPath: '#/required',
            params: {
              missingProperty: 'status'
            },
            message: 'should have required property \'status\''
          }];
          return false;
        } else {
          var errs_1 = errors;
          if (typeof data.status !== "string") {
            validate.errors = [{
              keyword: 'type',
              dataPath: (dataPath || '') + '.status',
              schemaPath: '#/properties/status/type',
              params: {
                type: 'string'
              },
              message: 'should be string'
            }];
            return false;
          }
          var valid1 = errors === errs_1;
        }
        if (valid1) {
          if (data.time === undefined) {
            valid1 = false;
            validate.errors = [{
              keyword: 'required',
              dataPath: (dataPath || '') + "",
              schemaPath: '#/required',
              params: {
                missingProperty: 'time'
              },
              message: 'should have required property \'time\''
            }];
            return false;
          } else {
            var errs_1 = errors;
            if (typeof data.time !== "string") {
              validate.errors = [{
                keyword: 'type',
                dataPath: (dataPath || '') + '.time',
                schemaPath: '#/properties/time/type',
                params: {
                  type: 'string'
                },
                message: 'should be string'
              }];
              return false;
            }
            var valid1 = errors === errs_1;
          }
          if (valid1) {
            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/job/update.schema.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "description": "A list of updates as job progresses. Keys shall be sorted in time order.",
  "type": "object",
  "properties": {
    "status": {
      "description": "Status of job at the time of update",
      "type": "string"
    },
    "time": {
      "description": "ISO8601 UTC date-time of update time",
      "type": "string"
    },
    "meta": {
      "description": "Additional meta data about the status update"
    }
  },
  "required": ["status", "time"],
  "examples": [{
    "status": "started",
    "time": "2018-11-14T20:20:39+00:00",
    "meta": {
      "example": "data"
    }
  }]
};
validate.errors = null;
module.exports = validate;