{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/deputy/json-schema/deputy-pay-rule-batch-save-request-schema.json",
  "title": "PayRuleBatchSaveRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/deputy-compliance-api-openapi.yml#/components/schemas/PayRuleBatchSaveRequest",
  "type": "object",
  "properties": {
    "contractId": {
      "type": "integer",
      "format": "int32"
    },
    "payRules": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/tenantcompliancev2modelPayRule"
      }
    },
    "confirmCustomisation": {
      "type": "boolean"
    }
  },
  "$defs": {
    "CustomFieldAnswerSystem": {
      "type": "string",
      "enum": [
        "UNSPECIFIED",
        "TIMESHEET",
        "EMPLOYEE",
        "ROSTER"
      ],
      "default": "UNSPECIFIED"
    },
    "FilterRRulePublicHolidayInclusionType": {
      "type": "string",
      "enum": [
        "PH_INCLUSION_UNSPECIFIED",
        "PH_ONLY",
        "NON_PH_ONLY"
      ],
      "default": "PH_INCLUSION_UNSPECIFIED"
    },
    "FilterShiftSchedulingType": {
      "type": "string",
      "enum": [
        "UNSPECIFIED",
        "SCHEDULED_ONLY",
        "UNSCHEDULED_ONLY"
      ],
      "default": "UNSPECIFIED"
    },
    "PayRulePayPortionRule": {
      "type": "string",
      "enum": [
        "PAY_PORTION_RULE_UNKNOWN",
        "PAY_PORTION_RULE_GREATER",
        "PAY_PORTION_RULE_EXACT",
        "PAY_PORTION_RULE_FULL"
      ],
      "default": "PAY_PORTION_RULE_UNKNOWN"
    },
    "PayRuleRemunerationBy": {
      "type": "string",
      "enum": [
        "REMUNERATION_BY_UNKNOWN",
        "REMUNERATION_BY_BASE",
        "REMUNERATION_BY_SHIFT_LOADING",
        "REMUNERATION_BY_PERIOD_LOADING"
      ],
      "default": "REMUNERATION_BY_UNKNOWN"
    },
    "PayRuleRemunerationType": {
      "type": "string",
      "enum": [
        "REMUNERATION_TYPE_UNKNOWN",
        "REMUNERATION_TYPE_HOURLY",
        "REMUNERATION_TYPE_MULTIPLIER",
        "REMUNERATION_TYPE_UNIT",
        "REMUNERATION_TYPE_SALARY"
      ],
      "default": "REMUNERATION_TYPE_UNKNOWN"
    },
    "modelCustomFieldAnswer": {
      "type": "object",
      "properties": {
        "identifier": {
          "type": "string",
          "title": "the unique identifier of the custom field (api_name)"
        },
        "system": {
          "$ref": "#/$defs/CustomFieldAnswerSystem",
          "title": "type of the custom field, i.e. \"TIMESHEET\" or \"EMPLOYEE\""
        },
        "configs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/modelCustomFieldAnswerConfig"
          },
          "title": "configuration for the custom field answer, i.e. operation and acceptable answers"
        },
        "type": {
          "$ref": "#/$defs/modelCustomFieldAnswerType",
          "title": "type of the custom field, e.g. list, boolean, number, text"
        },
        "action": {
          "$ref": "#/$defs/modelCustomFieldAnswerAction",
          "title": "specific action we would like to perform when checking the pay rule against the question/answer; Unspecified means it's the default filtering action"
        }
      }
    },
    "modelCustomFieldAnswerAction": {
      "type": "string",
      "enum": [
        "UNSPECIFIED_ACTION",
        "FILTER",
        "TOIL_ACCRUAL"
      ],
      "default": "UNSPECIFIED_ACTION",
      "title": "- UNSPECIFIED_ACTION: default is filter action, same as FILTER\n - FILTER: filter pay rule according to the CustomFieldAnswer setup\n - TOIL_ACCRUAL: convert Overtime to TimeOffInLieu when calculating shift cost"
    },
    "modelCustomFieldAnswerConfig": {
      "type": "object",
      "properties": {
        "operation": {
          "type": "string",
          "title": "one of eq, neq, gt, lt, gte, lte, in, nin"
        },
        "values": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "modelCustomFieldAnswerType": {
      "type": "string",
      "enum": [
        "TYPE_UNSPECIFIED",
        "TYPE_LIST",
        "TYPE_BOOL",
        "TYPE_NUMBER",
        "TYPE_TEXT",
        "TYPE_BOOL_YES_COMMENT",
        "TYPE_BOOL_NO_COMMENT"
      ],
      "default": "TYPE_UNSPECIFIED"
    },
    "modelLoadingLimit": {
      "type": "object",
      "properties": {
        "limitType": {
          "type": "string"
        },
        "limitPer": {
          "type": "string"
        },
        "customPeriod": {
          "type": "string"
        },
        "minValue": {
          "type": "number",
          "format": "float"
        },
        "maxValue": {
          "type": "number",
          "format": "float"
        }
      }
    },
    "modelPayConfig": {
      "type": "object",
      "properties": {
        "roundUpHours": {
          "type": "boolean"
        },
        "loadingLimit": {
          "$ref": "#/$defs/modelLoadingLimit"
        },
        "classificationReference": {
          "type": "string"
        }
      }
    },
    "modelPayRuleRateType": {
      "type": "string",
      "enum": [
        "RATE_TYPE_UNKNOWN",
        "RATE_TYPE_ORDINARY",
        "RATE_TYPE_OVERTIME",
        "RATE_TYPE_PENALTY",
        "RATE_TYPE_NON_PAYABLE"
      ],
      "default": "RATE_TYPE_UNKNOWN"
    },
    "modelTrainingRequirement": {
      "type": "object",
      "properties": {
        "module": {
          "type": "string",
          "format": "int64"
        }
      }
    },
    "tenantcompliancev2modelPayRule": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "format": "int64"
        },
        "title": {
          "type": "string"
        },
        "value": {
          "type": "number",
          "format": "double"
        },
        "remunerationBy": {
          "$ref": "#/$defs/PayRuleRemunerationBy"
        },
        "remunerationType": {
          "$ref": "#/$defs/PayRuleRemunerationType"
        },
        "isExported": {
          "type": "boolean"
        },
        "payrollCategory": {
          "type": "string"
        },
        "payPortionRule": {
          "$ref": "#/$defs/PayRulePayPortionRule"
        },
        "rateType": {
          "$ref": "#/$defs/modelPayRuleRateType"
        },
        "comment": {
          "type": "string"
        },
        "operationalUnitIds": {
          "type": "array",
          "items": {
            "type": "integer",
            "format": "int64"
          }
        },
        "calculationRuleId": {
          "type": "string"
        },
        "calculationTypeId": {
          "type": "string"
        },
        "filter": {
          "$ref": "#/$defs/v2modelFilter"
        },
        "localContext": {
          "type": "string"
        },
        "rateTag": {
          "type": "string"
        },
        "payConfig": {
          "$ref": "#/$defs/modelPayConfig"
        },
        "levelIds": {
          "type": "array",
          "items": {
            "type": "integer",
            "format": "int64"
          }
        },
        "levelAssnType": {
          "type": "integer",
          "format": "int64"
        },
        "stpClass": {
          "type": "string"
        },
        "stpCode": {
          "type": "string"
        },
        "toilMultiplier": {
          "type": "number",
          "format": "double",
          "title": "the Multiplier Rate that indicates how much TimeOffInLieu an hour of Overtime converts to"
        },
        "leaveRuleId": {
          "type": "integer",
          "format": "int64",
          "title": "the id of leave rule which TOIL Accrual goes to when TOIL is set up to convert OT to TOIL, only used with toilMultiplier"
        },
        "payrollTaxCode": {
          "type": "string"
        }
      }
    },
    "v2modelFilter": {
      "type": "object",
      "properties": {
        "customFieldAnswers": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/modelCustomFieldAnswer"
          }
        },
        "recurrenceRule": {
          "type": "string"
        },
        "shiftSchedulingType": {
          "$ref": "#/$defs/FilterShiftSchedulingType"
        },
        "shiftStartTimeRange": {
          "type": "string"
        },
        "shiftEndTimeRange": {
          "type": "string"
        },
        "rRulePublicHolidayInclusion": {
          "$ref": "#/$defs/FilterRRulePublicHolidayInclusionType",
          "title": "Determines recurrence rule is applicable on public holiday (recurrenceRule AND public holiday condition should be met)"
        },
        "particularDate": {
          "type": "string"
        },
        "applyOncePerDay": {
          "type": "boolean"
        },
        "areaNames": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "trainingRequirements": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/modelTrainingRequirement"
          }
        }
      }
    }
  }
}