{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"description":"Categorization of patrons.","properties":{"$schema":{"default":"https://bib.rero.ch/schemas/patron_types/patron_type-v0.0.1.json","minLength":9,"title":"Schema","type":"string"},"code":{"description":"Code to identify the patron type.","minLength":1,"title":"Code","type":"string"},"description":{"description":"The description of the patron type.","title":"Description","type":"string"},"limits":{"properties":{"checkout_limits":{"additionalProperties":false,"properties":{"global_limit":{"description":"The checkout is blocked once the specified checkout number is reached by the patron. This is a global checkout limit.","minimum":1,"title":"Number of checkouts in the organisation","type":"number"},"library_exceptions":{"items":{"properties":{"library":{"properties":{"$ref":{"pattern":"^https://bib.rero.ch/api/libraries/.*?$","title":"Library URI","type":"string","widget":{"formlyConfig":{"props":{"remoteOptions":{"type":"libraries"}}}}}},"required":["$ref"],"title":"Library","type":"object"},"value":{"minimum":1,"title":"Checkout limit","type":"number"}},"propertiesOrder":["library","value"],"required":["library","value"],"title":"Exception","type":"object"},"title":"Library checkout limit exceptions","type":"array"},"library_limit":{"description":"The checkout is blocked once the specified checkout number is reached by the patron for items of the same owning library. This is the same limit for all libraries.","minimum":1,"title":"Number of checkouts by library","type":"number"}},"propertiesOrder":["global_limit","library_limit","library_exceptions"],"required":["global_limit"],"title":"Limit by checkouts","type":"object"},"fee_amount_limits":{"additionalProperties":false,"properties":{"default_value":{"description":"The checkout, renewal and the request are blocked once the specified overdue fee amount is reached by the patron.","minimum":0,"title":"Fee amount","type":"number"}},"title":"Limit by overdue fee amount","type":"object"},"overdue_items_limits":{"additionalProperties":false,"properties":{"default_value":{"description":"The checkout, renewal and the request are blocked once the specified number of overdue items is reached by the patron.","minimum":1,"title":"Number of overdue items","type":"number"}},"title":"Limit by overdue items","type":"object"},"request_limits":{"additionalProperties":false,"properties":{"global_limit":{"description":"Requests are blocked once the specified number of requests is reached by the patron.","minimum":1,"title":"Number of active requests in the organisation","type":"number"},"library_exceptions":{"items":{"properties":{"library":{"properties":{"$ref":{"pattern":"^https://bib.rero.ch/api/libraries/.*?$","title":"Library URI","type":"string","widget":{"formlyConfig":{"props":{"remoteOptions":{"type":"libraries"}}}}}},"required":["$ref"],"title":"Library","type":"object"},"value":{"minimum":1,"title":"Requests limit","type":"number"}},"propertiesOrder":["library","value"],"required":["library","value"],"title":"Exception","type":"object"},"title":"Exceptions by library to the requests limits","type":"array","widget":{"formlyConfig":{"expressions":{"hide":"field?.parent?.model?.library_limit == 0"}}}},"library_limit":{"description":"Requests are blocked once the specified number of requests is reached by the patron for items of the same owning library. This is the same limit for all libraries.","minimum":1,"title":"Number of active requests by library","type":"number"}},"propertiesOrder":["global_limit","library_limit","library_exceptions"],"title":"Limit requests","type":"object"},"unpaid_subscription":{"default":true,"title":"Block the patron if the subscription is not paid","type":"boolean","widget":{"formlyConfig":{"expressions":{"hide":"field?.parent?.parent?.model?.subscription_amount <= 0"}}}}},"propertiesOrder":["unpaid_subscription","checkout_limits","request_limits","fee_amount_limits","overdue_items_limits"],"title":"Limits","type":"object"},"name":{"description":"The name of the patron type","minLength":2,"title":"Name","type":"string","widget":{"formlyConfig":{"focus":true,"props":{"validation":{"messages":{"alreadyTakenMessage":"This name is already taken."},"validators":{"valueAlreadyExists":{"term":"patron_type_name"}}}}}}},"organisation":{"additionalProperties":false,"properties":{"$ref":{"pattern":"^https://bib.rero.ch/api/organisations/.*?$","title":"Organisation URI","type":"string"}},"required":["$ref"],"title":"Organisation","type":"object"},"pid":{"minLength":1,"title":"Patron type ID","type":"string"},"subscription_amount":{"description":"Yearly amount due by patrons linked to this patron type.","exclusiveMinimum":0,"title":"Yearly subscription","type":"number"}},"propertiesOrder":["name","code","description","subscription_amount","limits"],"required":["$schema","pid","name","organisation"],"title":"Patron type","type":"object"}
