{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/folio/main/json-schema/folio-profile-dto-schema.json",
  "title": "profile_dto",
  "description": "Profile DTO",
  "x-generated": "2026-10-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/folio-mod-bulk-operations-openapi.yml#/components/schemas/profile_dto",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "UUID"
    },
    "name": {
      "description": "The name of the profile, used for identification and display.",
      "type": "string"
    },
    "description": {
      "description": "Indicates description of the profile.",
      "type": "string"
    },
    "locked": {
      "description": "Indicates whether the profile is locked and cannot be modified.",
      "type": "boolean"
    },
    "entityType": {
      "description": "Entity type",
      "$ref": "#/$defs/EntityType"
    },
    "ruleDetails": {
      "description": "Rule Collection",
      "type": "array",
      "items": {
        "$ref": "#/$defs/RuleDetails"
      }
    },
    "marcRuleDetails": {
      "description": "Bulk Operation Marc Rule Collection",
      "type": "array",
      "items": {
        "$ref": "#/$defs/MarcRuleDetails"
      }
    },
    "createdDate": {
      "description": "Date and time when the record was created",
      "type": "string",
      "format": "date-time"
    },
    "createdBy": {
      "description": "ID of the user who created the record (when available)",
      "type": "string",
      "format": "UUID"
    },
    "updatedDate": {
      "description": "Date and time when the record was last updated",
      "type": "string",
      "format": "date-time"
    },
    "updatedBy": {
      "description": "ID of the user who last updated the record (when available)",
      "type": "string",
      "format": "UUID"
    }
  },
  "additionalProperties": false,
  "required": [
    "id",
    "name",
    "entityType"
  ],
  "$defs": {
    "Action": {
      "description": "Rule action",
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/$defs/UpdateActionType"
        },
        "initial": {
          "description": "Initial value",
          "type": "string"
        },
        "updated": {
          "description": "Updated value",
          "type": "string"
        },
        "parameters": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Parameter"
          }
        },
        "tenants": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "updated_tenants": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "type"
      ],
      "additionalProperties": false
    },
    "EntityType": {
      "type": "string",
      "enum": [
        "USER",
        "ITEM",
        "HOLDINGS_RECORD",
        "INSTANCE",
        "INSTANCE_MARC"
      ]
    },
    "MarcAction": {
      "description": "MARC record bulk edit rule action",
      "type": "object",
      "properties": {
        "name": {
          "$ref": "#/$defs/UpdateActionType"
        },
        "data": {
          "type": "array",
          "items": {
            "description": "MARC rule action data",
            "type": "object",
            "properties": {
              "key": {
                "$ref": "#/$defs/MarcDataType"
              },
              "value": {
                "description": "Action value",
                "type": "string"
              }
            }
          }
        }
      },
      "required": [
        "name"
      ],
      "additionalProperties": false
    },
    "MarcDataType": {
      "type": "string",
      "enum": [
        "VALUE",
        "SUBFIELD"
      ]
    },
    "MarcParameter": {
      "description": "MARC rule parameter data",
      "type": "object",
      "properties": {
        "key": {
          "$ref": "#/$defs/MarcParameterType"
        },
        "value": {
          "description": "MARC rule parameter value",
          "type": "string"
        }
      },
      "required": [
        "key"
      ],
      "additionalProperties": false
    },
    "MarcParameterType": {
      "type": "string",
      "enum": [
        "OVERRIDE_PROTECTED"
      ]
    },
    "MarcRuleDetails": {
      "type": "object",
      "properties": {
        "tag": {
          "description": "MARC field tag",
          "type": "string"
        },
        "ind1": {
          "description": "MARC field indicator 1",
          "type": "string",
          "pattern": "[a-z0-9#\\\\]"
        },
        "ind2": {
          "description": "MARC field indicator 2",
          "type": "string",
          "pattern": "[a-z0-9#\\\\]"
        },
        "subfield": {
          "description": "MARC subfield code",
          "type": "string",
          "pattern": "[a-z0-9]*"
        },
        "actions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MarcAction"
          },
          "minItems": 1
        },
        "parameters": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MarcParameter"
          }
        },
        "subfields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MarcSubfieldAction"
          }
        },
        "updateOption": {
          "description": "Option to change",
          "$ref": "#/$defs/UpdateOptionType"
        }
      },
      "required": [
        "tag",
        "ind1",
        "ind2",
        "actions"
      ],
      "additionalProperties": false
    },
    "MarcSubfieldAction": {
      "description": "MARC record subfield rule action",
      "type": "object",
      "properties": {
        "subfield": {
          "description": "MARC subfield code",
          "type": "string"
        },
        "actions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MarcAction"
          },
          "minItems": 1
        }
      },
      "required": [
        "subfield",
        "actions"
      ],
      "additionalProperties": false
    },
    "Parameter": {
      "description": "Parameter for action",
      "type": "object",
      "properties": {
        "key": {
          "description": "Key of parameter",
          "type": "string"
        },
        "value": {
          "description": "Value of parameter",
          "type": "string"
        }
      },
      "required": [
        "key",
        "value"
      ],
      "additionalProperties": false
    },
    "RuleDetails": {
      "properties": {
        "option": {
          "description": "Option to change",
          "$ref": "#/$defs/UpdateOptionType"
        },
        "tenants": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "actions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Action"
          },
          "minItems": 1
        }
      },
      "additionalProperties": false
    },
    "UpdateActionType": {
      "type": "string",
      "enum": [
        "ADD_TO_EXISTING",
        "CLEAR_FIELD",
        "FIND",
        "FIND_AND_REMOVE_THESE",
        "REPLACE_WITH",
        "FIND_AND_REPLACE",
        "SET_TO_TRUE",
        "SET_TO_FALSE",
        "SET_TO_TRUE_INCLUDING_ITEMS",
        "SET_TO_FALSE_INCLUDING_ITEMS",
        "MARK_AS_STAFF_ONLY",
        "REMOVE_MARK_AS_STAFF_ONLY",
        "REMOVE_ALL",
        "CHANGE_TYPE",
        "DUPLICATE",
        "APPEND",
        "ADDITIONAL_SUBFIELD",
        "REMOVE_FIELD",
        "REMOVE_SUBFIELD",
        "",
        "REMOVE_SOME"
      ]
    },
    "UpdateOptionType": {
      "type": "string",
      "enum": [
        "ADMINISTRATIVE_NOTE",
        "CHECK_IN_NOTE",
        "CHECK_OUT_NOTE",
        "ELECTRONIC_ACCESS_LINK_TEXT",
        "ELECTRONIC_ACCESS_MATERIALS_SPECIFIED",
        "ELECTRONIC_ACCESS_URI",
        "ELECTRONIC_ACCESS_URL_PUBLIC_NOTE",
        "ELECTRONIC_ACCESS_URL_RELATIONSHIP",
        "EMAIL_ADDRESS",
        "EXPIRATION_DATE",
        "HOLDINGS_NOTE",
        "INSTANCE_NOTE",
        "ITEM_NOTE",
        "MATERIAL_TYPE",
        "PATRON_GROUP",
        "PERMANENT_LOAN_TYPE",
        "PERMANENT_LOCATION",
        "SET_RECORDS_FOR_DELETE",
        "STAFF_SUPPRESS",
        "STATISTICAL_CODE",
        "STATUS",
        "SUPPRESS_FROM_DISCOVERY",
        "TEMPORARY_LOAN_TYPE",
        "TEMPORARY_LOCATION"
      ]
    }
  }
}