{
   "$schema": "http://psd2.pl/scope_details/1.0.0/schema#",
   "$id": "http://psd2.pl/scope_details/1.0.0/schema#",
   "title": "Specyfikacja struktury danych parametru scope_detail - rozszerzenia w stosunku do standardu OAuth2. Przygotowane przez Związek Banków Polskich i spółki z nim powiązane",
    "scope_details_in" : {
      "type" : "object",
      "required" : [ "consentId", "privilegeList", "recurringIndicator", "resource", "scopeGroupType", "scopeTimeDuration", "scopeTimeLimit", "throttlingPolicy" ],
      "properties" : {
        "privilegeList" : {
          "$ref" : "#/definitions/scope_details_in_privilegeList"
        },
        "scopeGroupType" : {
          "type" : "string",
          "title" : "Type of consent",
          "enum" : [ "accountInformationService", "paymentInformationService", "confirmationOfFunds" ]
        },
        "consentId" : {
          "type" : "string",
          "title" : "Id of consent"
        },
        "resource" : {
          "$ref" : "#/definitions/scope_details_in_resource"
        },
        "recurringIndicator" : {
          "type" : "boolean",
          "description" : "Whether the consent is multiple or one-time"
        },
        "scopeTimeDuration" : {
          "type" : "integer",
          "title" : "Validity in minutes"
        },
        "scopeTimeLimit" : {
          "type" : "string",
          "format" : "datetime",
          "description" : "consent valid until"
        },
        "throttlingPolicy" : {
          "type" : "string",
          "title" : "Throttling policy",
          "enum" : [ "psd2Regulatory" ]
        }
      }
    },
    "scope_details_out" : {
      "type" : "object",
      "required" : [ "consentId", "privilegeList", "recurringIndicator", "resource", "scopeGroupType", "scopeTimeDuration", "scopeTimeLimit", "throttlingPolicy" ],
      "properties" : {
        "privilegeList" : {
          "$ref" : "#/definitions/scope_details_out_privilegeList"
        },
        "scopeGroupType" : {
          "type" : "string",
          "title" : "Type of consent",
          "enum" : [ "accountInformationService", "paymentInformationService", "confirmationOfFunds" ]
        },
        "consentId" : {
          "type" : "string",
          "title" : "Id of consent"
        },
        "resource" : {
          "$ref" : "#/definitions/scope_details_in_resource"
        },
        "recurringIndicator" : {
          "type" : "boolean",
          "description" : "Whether the consent is multiple or one-time"
        },
        "scopeTimeDuration" : {
          "type" : "integer",
          "title" : "Validity in minutes"
        },
        "scopeTimeLimit" : {
          "type" : "string",
          "format" : "datetime",
          "description" : "consent valid until"
        },
        "throttlingPolicy" : {
          "type" : "string",
          "title" : "Throttling policy",
          "enum" : [ "psd2Regulatory" ]
        }
      },
      "example" : {
        "consentId" : "consentId",
        "resource" : {
          "accounts" : [ "accounts", "accounts" ]
        },
        "scopeTimeLimit" : "scopeTimeLimit",
        "recurringIndicator" : true,
        "scopeTimeDuration" : 3,
        "throttlingPolicy" : "psd2Regulatory",
        "scopeGroupType" : "accountInformationService",
        "privilegeList" : {
          "ais:transactionsDone" : {
            "notAfter" : "notAfter",
            "scopeUsageLimit" : 1,
            "maxAllowedHistoryLong" : 880,
            "notBefore" : "notBefore"
          },
          "ais:holds" : {
            "notAfter" : "notAfter",
            "scopeUsageLimit" : 1,
            "maxAllowedHistoryLong" : 880,
            "notBefore" : "notBefore"
          },
          "ais:transactionsRejected" : {
            "notAfter" : "notAfter",
            "scopeUsageLimit" : 1,
            "maxAllowedHistoryLong" : 880,
            "notBefore" : "notBefore"
          },
          "ais:accounts" : {
            "notAfter" : "notAfter",
            "scopeUsageLimit" : 1,
            "maxAllowedHistoryLong" : 880,
            "notBefore" : "notBefore"
          },
          "pis:tax" : {
            "scopeUsageLimit" : 1
          },
          "pis:payment" : {
            "scopeUsageLimit" : 1
          },
          "pis:domestic" : {
            "scopeUsageLimit" : 1
          },
          "ais:transactionDetail" : {
            "notAfter" : "notAfter",
            "scopeUsageLimit" : 1,
            "maxAllowedHistoryLong" : 880,
            "notBefore" : "notBefore"
          },
          "caf:confirmationOfFunds" : {
            "amount" : 9.301444243932575517419536481611430644989013671875,
            "scopeUsageLimit" : 1,
            "currency" : "currency"
          },
          "ais:transactionsPending" : {
            "notAfter" : "notAfter",
            "scopeUsageLimit" : 1,
            "maxAllowedHistoryLong" : 880,
            "notBefore" : "notBefore"
          },
          "pis:multiplePayments" : {
            "scopeUsageLimit" : 1
          },
          "pis:foreign" : {
            "scopeUsageLimit" : 1
          }
        }
      }
    },
    "privilegeAisAspspIn" : {
      "type" : "object",
      "required" : [ "maxAllowedHistoryLong" ],
      "properties" : {
        "scopeUsageLimit" : {
          "type" : "integer",
          "title" : "Limit of usages",
          "minimum" : 1
        },
        "maxAllowedHistoryLong" : {
          "type" : "integer",
          "title" : "How much history is allowed in days",
          "minimum" : 1,
          "maximum" : 1460
        }
      }
    },
    "privilegeAisAspspOut" : {
      "type" : "object",
      "required" : [ "maxAllowedHistoryLong", "notAfter", "notBefore" ],
      "properties" : {
        "scopeUsageLimit" : {
          "type" : "integer",
          "title" : "Limit of usages",
          "minimum" : 1
        },
        "maxAllowedHistoryLong" : {
          "type" : "integer",
          "title" : "How much history is allowed in days",
          "minimum" : 1,
          "maximum" : 1460
        },
        "notBefore" : {
          "type" : "string",
          "format" : "datetime",
          "description" : "Minimum date for transaction that will be returned"
        },
        "notAfter" : {
          "type" : "string",
          "format" : "datetime",
          "description" : "Maximum date for transaction that will be returned"
        }
      },
      "example" : {
        "notAfter" : "notAfter",
        "scopeUsageLimit" : 1,
        "maxAllowedHistoryLong" : 880,
        "notBefore" : "notBefore"
      }
    },
    "privilegePayment" : {
      "type" : "object",
      "properties" : {
        "scopeUsageLimit" : {
          "type" : "integer",
          "title" : "Limit of usages",
          "minimum" : 1
        }
      },
      "description" : "List of the attributes must be the same as in payment",
      "example" : {
        "scopeUsageLimit" : 1
      }
    },
    "privilegeDomesticTransfer" : {
      "type" : "object",
      "properties" : {
        "scopeUsageLimit" : {
          "type" : "integer",
          "title" : "Limit of usages",
          "minimum" : 1
        }
      },
      "description" : "List of the attributes must be the same as in domestic transfer",
      "example" : {
        "scopeUsageLimit" : 1
      }
    },
    "privilegeForeignTransfer" : {
      "type" : "object",
      "properties" : {
        "scopeUsageLimit" : {
          "type" : "integer",
          "title" : "Limit of usages",
          "minimum" : 1
        }
      },
      "description" : "List of the attributes must be the same as in foreign transfer",
      "example" : {
        "scopeUsageLimit" : 1
      }
    },
    "privilegeTaxTransfer" : {
      "type" : "object",
      "properties" : {
        "scopeUsageLimit" : {
          "type" : "integer",
          "title" : "Limit of usages",
          "minimum" : 1
        }
      },
      "description" : "List of the attributes must be the same as in tax transfer",
      "example" : {
        "scopeUsageLimit" : 1
      }
    },
    "privilegeCaF" : {
      "type" : "object",
      "required" : [ "amount", "currency" ],
      "properties" : {
        "scopeUsageLimit" : {
          "type" : "integer",
          "title" : "Limit of usages",
          "minimum" : 1
        },
        "amount" : {
          "type" : "number",
          "format" : "decimal"
        },
        "currency" : {
          "type" : "string",
          "maxLength" : 3
        }
      },
      "example" : {
        "amount" : 9.301444243932575517419536481611430644989013671875,
        "scopeUsageLimit" : 1,
        "currency" : "currency"
      }
    },
    "scope_details_in_privilegeList" : {
      "properties" : {
        "ais:accounts" : {
          "$ref" : "#/definitions/privilegeAisAspspIn"
        },
        "ais:holds" : {
          "$ref" : "#/definitions/privilegeAisAspspIn"
        },
        "ais:transactionsDone" : {
          "$ref" : "#/definitions/privilegeAisAspspIn"
        },
        "ais:transactionsPending" : {
          "$ref" : "#/definitions/privilegeAisAspspIn"
        },
        "ais:transactionsRejected" : {
          "$ref" : "#/definitions/privilegeAisAspspIn"
        },
        "ais:transactionDetail" : {
          "$ref" : "#/definitions/privilegeAisAspspIn"
        },
        "pis:multiplePayments" : {
          "$ref" : "#/definitions/privilegePayment"
        },
        "pis:payment" : {
          "$ref" : "#/definitions/privilegePayment"
        },
        "pis:domestic" : {
          "$ref" : "#/definitions/privilegeDomesticTransfer"
        },
        "pis:foreign" : {
          "$ref" : "#/definitions/privilegeForeignTransfer"
        },
        "pis:tax" : {
          "$ref" : "#/definitions/privilegeTaxTransfer"
        },
        "caf:confirmationOfFunds" : {
          "$ref" : "#/definitions/privilegeCaF"
        }
      }
    },
    "scope_details_in_resource" : {
      "required" : [ "accounts" ],
      "properties" : {
        "accounts" : {
          "type" : "array",
          "description" : "Account numbers in IBAN format",
          "items" : {
            "type" : "string",
            "title" : "Account numbers List"
          }
        }
      },
      "example" : {
        "accounts" : [ "accounts", "accounts" ]
      }
    },
    "scope_details_out_privilegeList" : {
      "properties" : {
        "ais:accounts" : {
          "$ref" : "#/definitions/privilegeAisAspspOut"
        },
        "ais:holds" : {
          "$ref" : "#/definitions/privilegeAisAspspOut"
        },
        "ais:transactionsDone" : {
          "$ref" : "#/definitions/privilegeAisAspspOut"
        },
        "ais:transactionsPending" : {
          "$ref" : "#/definitions/privilegeAisAspspOut"
        },
        "ais:transactionsRejected" : {
          "$ref" : "#/definitions/privilegeAisAspspOut"
        },
        "ais:transactionDetail" : {
          "$ref" : "#/definitions/privilegeAisAspspOut"
        },
        "pis:multiplePayments" : {
          "$ref" : "#/definitions/privilegePayment"
        },
        "pis:payment" : {
          "$ref" : "#/definitions/privilegePayment"
        },
        "pis:domestic" : {
          "$ref" : "#/definitions/privilegeDomesticTransfer"
        },
        "pis:foreign" : {
          "$ref" : "#/definitions/privilegeForeignTransfer"
        },
        "pis:tax" : {
          "$ref" : "#/definitions/privilegeTaxTransfer"
        },
        "caf:confirmationOfFunds" : {
          "$ref" : "#/definitions/privilegeCaF"
        }
      },
      "example" : {
        "ais:transactionsDone" : {
          "notAfter" : "notAfter",
          "scopeUsageLimit" : 1,
          "maxAllowedHistoryLong" : 880,
          "notBefore" : "notBefore"
        },
        "ais:holds" : {
          "notAfter" : "notAfter",
          "scopeUsageLimit" : 1,
          "maxAllowedHistoryLong" : 880,
          "notBefore" : "notBefore"
        },
        "ais:transactionsRejected" : {
          "notAfter" : "notAfter",
          "scopeUsageLimit" : 1,
          "maxAllowedHistoryLong" : 880,
          "notBefore" : "notBefore"
        },
        "ais:accounts" : {
          "notAfter" : "notAfter",
          "scopeUsageLimit" : 1,
          "maxAllowedHistoryLong" : 880,
          "notBefore" : "notBefore"
        },
        "pis:tax" : {
          "scopeUsageLimit" : 1
        },
        "pis:payment" : {
          "scopeUsageLimit" : 1
        },
        "pis:domestic" : {
          "scopeUsageLimit" : 1
        },
        "ais:transactionDetail" : {
          "notAfter" : "notAfter",
          "scopeUsageLimit" : 1,
          "maxAllowedHistoryLong" : 880,
          "notBefore" : "notBefore"
        },
        "caf:confirmationOfFunds" : {
          "amount" : 9.301444243932575517419536481611430644989013671875,
          "scopeUsageLimit" : 1,
          "currency" : "currency"
        },
        "ais:transactionsPending" : {
          "notAfter" : "notAfter",
          "scopeUsageLimit" : 1,
          "maxAllowedHistoryLong" : 880,
          "notBefore" : "notBefore"
        },
        "pis:multiplePayments" : {
          "scopeUsageLimit" : 1
        },
        "pis:foreign" : {
          "scopeUsageLimit" : 1
        }
      }
    }
  }