'use strict';
var formats = require('ajv/lib/compile/formats')();
var validate = (function() {
  var pattern0 = new RegExp('^https://.*');
  var refVal = [];
  return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
    'use strict'; /*# sourceURL=https://formats.openag.io/oada/oauth-dyn-reg/register-response/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;
        if (data.client_id === undefined) {
          valid1 = false;
          validate.errors = [{
            keyword: 'required',
            dataPath: (dataPath || '') + "",
            schemaPath: '#/required',
            params: {
              missingProperty: 'client_id'
            },
            message: 'should have required property \'client_id\''
          }];
          return false;
        } else {
          var errs_1 = errors;
          if (typeof data.client_id !== "string") {
            validate.errors = [{
              keyword: 'type',
              dataPath: (dataPath || '') + '.client_id',
              schemaPath: '#/properties/client_id/type',
              params: {
                type: 'string'
              },
              message: 'should be string'
            }];
            return false;
          }
          var valid1 = errors === errs_1;
        }
        if (valid1) {
          if (data.client_id_issued_at === undefined) {
            valid1 = false;
            validate.errors = [{
              keyword: 'required',
              dataPath: (dataPath || '') + "",
              schemaPath: '#/required',
              params: {
                missingProperty: 'client_id_issued_at'
              },
              message: 'should have required property \'client_id_issued_at\''
            }];
            return false;
          } else {
            var errs_1 = errors;
            if ((typeof data.client_id_issued_at !== "number")) {
              validate.errors = [{
                keyword: 'type',
                dataPath: (dataPath || '') + '.client_id_issued_at',
                schemaPath: '#/properties/client_id_issued_at/type',
                params: {
                  type: 'number'
                },
                message: 'should be number'
              }];
              return false;
            }
            var valid1 = errors === errs_1;
          }
          if (valid1) {
            if (data.scopes === undefined) {
              valid1 = false;
              validate.errors = [{
                keyword: 'required',
                dataPath: (dataPath || '') + "",
                schemaPath: '#/required',
                params: {
                  missingProperty: 'scopes'
                },
                message: 'should have required property \'scopes\''
              }];
              return false;
            } else {
              var errs_1 = errors;
              if (typeof data.scopes !== "string") {
                validate.errors = [{
                  keyword: 'type',
                  dataPath: (dataPath || '') + '.scopes',
                  schemaPath: '#/properties/scopes/type',
                  params: {
                    type: 'string'
                  },
                  message: 'should be string'
                }];
                return false;
              }
              var valid1 = errors === errs_1;
            }
            if (valid1) {
              var data1 = data.redirect_uris;
              if (data1 === undefined) {
                valid1 = false;
                validate.errors = [{
                  keyword: 'required',
                  dataPath: (dataPath || '') + "",
                  schemaPath: '#/required',
                  params: {
                    missingProperty: 'redirect_uris'
                  },
                  message: 'should have required property \'redirect_uris\''
                }];
                return false;
              } else {
                var errs_1 = errors;
                if (Array.isArray(data1)) {
                  if (data1.length < 1) {
                    validate.errors = [{
                      keyword: 'minItems',
                      dataPath: (dataPath || '') + '.redirect_uris',
                      schemaPath: '#/properties/redirect_uris/minItems',
                      params: {
                        limit: 1
                      },
                      message: 'should NOT have fewer than 1 items'
                    }];
                    return false;
                  } else {
                    var errs__1 = errors;
                    var valid1;
                    for (var i1 = 0; i1 < data1.length; i1++) {
                      var data2 = data1[i1];
                      var errs_2 = errors;
                      if (typeof data2 === "string") {
                        if (!pattern0.test(data2)) {
                          validate.errors = [{
                            keyword: 'pattern',
                            dataPath: (dataPath || '') + '.redirect_uris[' + i1 + ']',
                            schemaPath: '#/properties/redirect_uris/items/pattern',
                            params: {
                              pattern: '^https://.*'
                            },
                            message: 'should match pattern "^https://.*"'
                          }];
                          return false;
                        } else {}
                      } else {
                        validate.errors = [{
                          keyword: 'type',
                          dataPath: (dataPath || '') + '.redirect_uris[' + i1 + ']',
                          schemaPath: '#/properties/redirect_uris/items/type',
                          params: {
                            type: 'string'
                          },
                          message: 'should be string'
                        }];
                        return false;
                      }
                      if (errors === errs_2) {}
                      var valid2 = errors === errs_2;
                      if (!valid2) break;
                    }
                    if (errs__1 == errors) {
                      var i = data1.length,
                        valid1 = true,
                        j;
                      if (i > 1) {
                        var itemIndices = {},
                          item;
                        for (; i--;) {
                          var item = data1[i];
                          if (typeof item !== "string") continue;
                          if (typeof itemIndices[item] == 'number') {
                            valid1 = false;
                            j = itemIndices[item];
                            break;
                          }
                          itemIndices[item] = i;
                        }
                      }
                      if (!valid1) {
                        validate.errors = [{
                          keyword: 'uniqueItems',
                          dataPath: (dataPath || '') + '.redirect_uris',
                          schemaPath: '#/properties/redirect_uris/uniqueItems',
                          params: {
                            i: i,
                            j: j
                          },
                          message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)'
                        }];
                        return false;
                      } else {}
                    }
                  }
                } else {
                  validate.errors = [{
                    keyword: 'type',
                    dataPath: (dataPath || '') + '.redirect_uris',
                    schemaPath: '#/properties/redirect_uris/type',
                    params: {
                      type: 'array'
                    },
                    message: 'should be array'
                  }];
                  return false;
                }
                if (errors === errs_1) {}
                var valid1 = errors === errs_1;
              }
              if (valid1) {
                if (data.token_endpoint_auth_method === undefined) {
                  valid1 = false;
                  validate.errors = [{
                    keyword: 'required',
                    dataPath: (dataPath || '') + "",
                    schemaPath: '#/required',
                    params: {
                      missingProperty: 'token_endpoint_auth_method'
                    },
                    message: 'should have required property \'token_endpoint_auth_method\''
                  }];
                  return false;
                } else {
                  var errs_1 = errors;
                  if (typeof data.token_endpoint_auth_method !== "string") {
                    validate.errors = [{
                      keyword: 'type',
                      dataPath: (dataPath || '') + '.token_endpoint_auth_method',
                      schemaPath: '#/properties/token_endpoint_auth_method/type',
                      params: {
                        type: 'string'
                      },
                      message: 'should be string'
                    }];
                    return false;
                  }
                  var valid1 = errors === errs_1;
                }
                if (valid1) {
                  var data1 = data.grant_types;
                  if (data1 === undefined) {
                    valid1 = false;
                    validate.errors = [{
                      keyword: 'required',
                      dataPath: (dataPath || '') + "",
                      schemaPath: '#/required',
                      params: {
                        missingProperty: 'grant_types'
                      },
                      message: 'should have required property \'grant_types\''
                    }];
                    return false;
                  } else {
                    var errs_1 = errors;
                    if (Array.isArray(data1)) {
                      if (data1.length < 1) {
                        validate.errors = [{
                          keyword: 'minItems',
                          dataPath: (dataPath || '') + '.grant_types',
                          schemaPath: '#/properties/grant_types/minItems',
                          params: {
                            limit: 1
                          },
                          message: 'should NOT have fewer than 1 items'
                        }];
                        return false;
                      } else {
                        var errs__1 = errors;
                        var valid1;
                        for (var i1 = 0; i1 < data1.length; i1++) {
                          var errs_2 = errors;
                          if (typeof data1[i1] !== "string") {
                            validate.errors = [{
                              keyword: 'type',
                              dataPath: (dataPath || '') + '.grant_types[' + i1 + ']',
                              schemaPath: '#/properties/grant_types/items/type',
                              params: {
                                type: 'string'
                              },
                              message: 'should be string'
                            }];
                            return false;
                          }
                          var valid2 = errors === errs_2;
                          if (!valid2) break;
                        }
                        if (errs__1 == errors) {
                          var i = data1.length,
                            valid1 = true,
                            j;
                          if (i > 1) {
                            var itemIndices = {},
                              item;
                            for (; i--;) {
                              var item = data1[i];
                              if (typeof item !== "string") continue;
                              if (typeof itemIndices[item] == 'number') {
                                valid1 = false;
                                j = itemIndices[item];
                                break;
                              }
                              itemIndices[item] = i;
                            }
                          }
                          if (!valid1) {
                            validate.errors = [{
                              keyword: 'uniqueItems',
                              dataPath: (dataPath || '') + '.grant_types',
                              schemaPath: '#/properties/grant_types/uniqueItems',
                              params: {
                                i: i,
                                j: j
                              },
                              message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)'
                            }];
                            return false;
                          } else {}
                        }
                      }
                    } else {
                      validate.errors = [{
                        keyword: 'type',
                        dataPath: (dataPath || '') + '.grant_types',
                        schemaPath: '#/properties/grant_types/type',
                        params: {
                          type: 'array'
                        },
                        message: 'should be array'
                      }];
                      return false;
                    }
                    if (errors === errs_1) {}
                    var valid1 = errors === errs_1;
                  }
                  if (valid1) {
                    var data1 = data.response_types;
                    if (data1 === undefined) {
                      valid1 = false;
                      validate.errors = [{
                        keyword: 'required',
                        dataPath: (dataPath || '') + "",
                        schemaPath: '#/required',
                        params: {
                          missingProperty: 'response_types'
                        },
                        message: 'should have required property \'response_types\''
                      }];
                      return false;
                    } else {
                      var errs_1 = errors;
                      if (Array.isArray(data1)) {
                        if (data1.length < 1) {
                          validate.errors = [{
                            keyword: 'minItems',
                            dataPath: (dataPath || '') + '.response_types',
                            schemaPath: '#/properties/response_types/minItems',
                            params: {
                              limit: 1
                            },
                            message: 'should NOT have fewer than 1 items'
                          }];
                          return false;
                        } else {
                          var errs__1 = errors;
                          var valid1;
                          for (var i1 = 0; i1 < data1.length; i1++) {
                            var errs_2 = errors;
                            if (typeof data1[i1] !== "string") {
                              validate.errors = [{
                                keyword: 'type',
                                dataPath: (dataPath || '') + '.response_types[' + i1 + ']',
                                schemaPath: '#/properties/response_types/items/type',
                                params: {
                                  type: 'string'
                                },
                                message: 'should be string'
                              }];
                              return false;
                            }
                            var valid2 = errors === errs_2;
                            if (!valid2) break;
                          }
                          if (errs__1 == errors) {
                            var i = data1.length,
                              valid1 = true,
                              j;
                            if (i > 1) {
                              var itemIndices = {},
                                item;
                              for (; i--;) {
                                var item = data1[i];
                                if (typeof item !== "string") continue;
                                if (typeof itemIndices[item] == 'number') {
                                  valid1 = false;
                                  j = itemIndices[item];
                                  break;
                                }
                                itemIndices[item] = i;
                              }
                            }
                            if (!valid1) {
                              validate.errors = [{
                                keyword: 'uniqueItems',
                                dataPath: (dataPath || '') + '.response_types',
                                schemaPath: '#/properties/response_types/uniqueItems',
                                params: {
                                  i: i,
                                  j: j
                                },
                                message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)'
                              }];
                              return false;
                            } else {}
                          }
                        }
                      } else {
                        validate.errors = [{
                          keyword: 'type',
                          dataPath: (dataPath || '') + '.response_types',
                          schemaPath: '#/properties/response_types/type',
                          params: {
                            type: 'array'
                          },
                          message: 'should be array'
                        }];
                        return false;
                      }
                      if (errors === errs_1) {}
                      var valid1 = errors === errs_1;
                    }
                    if (valid1) {
                      var data1 = data.tos_uri;
                      if (data1 === undefined) {
                        valid1 = false;
                        validate.errors = [{
                          keyword: 'required',
                          dataPath: (dataPath || '') + "",
                          schemaPath: '#/required',
                          params: {
                            missingProperty: 'tos_uri'
                          },
                          message: 'should have required property \'tos_uri\''
                        }];
                        return false;
                      } else {
                        var errs_1 = errors;
                        if ((typeof data1 === "number")) {
                          if (true) {}
                        }
                        if (errors === errs_1) {
                          if (typeof data1 === "string") {
                            if (!formats.uri.test(data1)) {
                              validate.errors = [{
                                keyword: 'format',
                                dataPath: (dataPath || '') + '.tos_uri',
                                schemaPath: '#/properties/tos_uri/format',
                                params: {
                                  format: 'uri'
                                },
                                message: 'should match format "uri"'
                              }];
                              return false;
                            } else {}
                          } else {
                            validate.errors = [{
                              keyword: 'type',
                              dataPath: (dataPath || '') + '.tos_uri',
                              schemaPath: '#/properties/tos_uri/type',
                              params: {
                                type: 'string'
                              },
                              message: 'should be string'
                            }];
                            return false;
                          }
                          if (errors === errs_1) {}
                        }
                        var valid1 = errors === errs_1;
                      }
                      if (valid1) {
                        var data1 = data.policy_uri;
                        if (data1 === undefined) {
                          valid1 = false;
                          validate.errors = [{
                            keyword: 'required',
                            dataPath: (dataPath || '') + "",
                            schemaPath: '#/required',
                            params: {
                              missingProperty: 'policy_uri'
                            },
                            message: 'should have required property \'policy_uri\''
                          }];
                          return false;
                        } else {
                          var errs_1 = errors;
                          if ((typeof data1 === "number")) {
                            if (true) {}
                          }
                          if (errors === errs_1) {
                            if (typeof data1 === "string") {
                              if (!formats.uri.test(data1)) {
                                validate.errors = [{
                                  keyword: 'format',
                                  dataPath: (dataPath || '') + '.policy_uri',
                                  schemaPath: '#/properties/policy_uri/format',
                                  params: {
                                    format: 'uri'
                                  },
                                  message: 'should match format "uri"'
                                }];
                                return false;
                              } else {}
                            } else {
                              validate.errors = [{
                                keyword: 'type',
                                dataPath: (dataPath || '') + '.policy_uri',
                                schemaPath: '#/properties/policy_uri/type',
                                params: {
                                  type: 'string'
                                },
                                message: 'should be string'
                              }];
                              return false;
                            }
                            if (errors === errs_1) {}
                          }
                          var valid1 = errors === errs_1;
                        }
                        if (valid1) {
                          if (data.software_id === undefined) {
                            valid1 = false;
                            validate.errors = [{
                              keyword: 'required',
                              dataPath: (dataPath || '') + "",
                              schemaPath: '#/required',
                              params: {
                                missingProperty: 'software_id'
                              },
                              message: 'should have required property \'software_id\''
                            }];
                            return false;
                          } else {
                            var errs_1 = errors;
                            if (typeof data.software_id !== "string") {
                              validate.errors = [{
                                keyword: 'type',
                                dataPath: (dataPath || '') + '.software_id',
                                schemaPath: '#/properties/software_id/type',
                                params: {
                                  type: 'string'
                                },
                                message: 'should be string'
                              }];
                              return false;
                            }
                            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/oauth-dyn-reg/register-response/v1.schema.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "description": "application/vnd.oada.oauth-dny-reg.register-response.1+json",
  "required": ["client_id", "client_id_issued_at", "scopes", "redirect_uris", "token_endpoint_auth_method", "grant_types", "response_types", "tos_uri", "policy_uri", "software_id"],
  "additionalProperties": true,
  "properties": {
    "client_id": {
      "type": "string"
    },
    "client_id_issued_at": {
      "type": "number"
    },
    "scopes": {
      "type": "string"
    },
    "redirect_uris": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "pattern": "^https://.*"
      }
    },
    "token_endpoint_auth_method": {
      "type": "string"
    },
    "grant_types": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "type": "string"
      }
    },
    "response_types": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "type": "string"
      }
    },
    "tos_uri": {
      "type": "string",
      "format": "uri"
    },
    "policy_uri": {
      "type": "string",
      "format": "uri"
    },
    "software_id": {
      "type": "string"
    }
  },
  "type": "object",
  "examples": [{
    "client_id": "3klaxu838akahf38acucaix73",
    "client_id_issued_at": 1418423102,
    "software_version": "1.0-ga",
    "scopes": "read:planting.prescriptions write:fields",
    "redirect_uris": ["https://client.example.com/callback", "https://client.example.com/cb"],
    "token_endpoint_auth_method": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
    "grant_types": ["implicit", "authorization_code", "refresh_token"],
    "response_types": ["token", "code"],
    "client_name": "Example OADA Client",
    "client_uri": "http://example.com",
    "logo_uri": "http://example.com/logo.png",
    "contacts": ["Clint Client <cclient@example.com>"],
    "tos_uri": "http://example.com/tos.html",
    "policy_uri": "http://example.com/policy.html",
    "software_id": "djxkjau3n937xz7jakl3",
    "registration_provider": "registration.example.com"
  }]
};
validate.errors = null;
module.exports = validate;