+=head3 rule_kinds
+
+This structure describes the possible rules that may be set, and what scopes they can be set at.
+
+Any attempt to set a rule with a nonsensical scope (for instance, setting the C<patron_maxissueqty> for a branchcode and itemtype), is an error.
+
+=cut
+
+our $RULE_KINDS = {
+ lostreturn => {
+ scope => [ 'branchcode' ],
+ },
+ processingreturn => {
+ scope => [ 'branchcode' ],
+ },
+ patron_maxissueqty => {
+ scope => [ 'branchcode', 'categorycode' ],
+ },
+ patron_maxonsiteissueqty => {
+ scope => [ 'branchcode', 'categorycode' ],
+ },
+ max_holds => {
+ scope => [ 'branchcode', 'categorycode' ],
+ },
+
+ holdallowed => {
+ scope => [ 'branchcode', 'itemtype' ],
+ can_be_blank => 0,
+ },
+ hold_fulfillment_policy => {
+ scope => [ 'branchcode', 'itemtype' ],
+ can_be_blank => 0,
+ },
+ returnbranch => {
+ scope => [ 'branchcode', 'itemtype' ],
+ can_be_blank => 0,
+ },
+
+ article_requests => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ article_request_fee => {
+ scope => [ 'branchcode', 'categorycode' ],
+ },
+ open_article_requests_limit => {
+ scope => [ 'branchcode', 'categorycode' ],
+ },
+
+ auto_renew => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ cap_fine_to_replacement_price => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ chargeperiod => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ chargeperiod_charge_at => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ fine => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ finedays => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ firstremind => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ hardduedate => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ hardduedatecompare => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ waiting_hold_cancellation => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ can_be_blank => 0,
+ },
+ holds_per_day => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ holds_per_record => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ issuelength => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ daysmode => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ lengthunit => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ maxissueqty => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ maxonsiteissueqty => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ maxsuspensiondays => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ no_auto_renewal_after => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ no_auto_renewal_after_hard_limit => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ norenewalbefore => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ onshelfholds => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ opacitemholds => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ overduefinescap => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ renewalperiod => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ renewalsallowed => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ unseen_renewals_allowed => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ rentaldiscount => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ can_be_blank => 0,
+ },
+ reservesallowed => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ suspension_chargeperiod => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ note => { # This is not really a rule. Maybe we will want to separate this later.
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ decreaseloanholds => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ recalls_allowed => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ recalls_per_record => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ on_shelf_recalls => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ recall_due_date_interval => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ recall_overdue_fine => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ recall_shelf_time => {
+ scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+ },
+ # Not included (deprecated?):
+ # * accountsent
+ # * reservecharge
+ # * restrictedtype
+};
+
+sub rule_kinds {
+ return $RULE_KINDS;
+}
+