{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nice/json-schema/nice-policy-retrieval-response-schema.json",
  "title": "PolicyRetrievalResponse",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nice-policy-policyinstance-openapi.yml#/components/schemas/PolicyRetrievalResponse",
  "type": "object",
  "properties": {
    "policyId": {
      "type": "string",
      "format": "uuid",
      "description": "The Id of the policy"
    },
    "policyName": {
      "type": "string",
      "description": "The name of the policy"
    },
    "initiatorType": {
      "type": "string",
      "description": "The source of policy. possible values - API, DASHBOARD, DATA_POLICIES "
    },
    "policyType": {
      "type": "string",
      "description": "The type of of the policy"
    },
    "entityType": {
      "type": "string",
      "description": "The entities which the policy affects"
    },
    "applyToMediaTypes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The media types which the policy affects"
    },
    "criteria": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Criteria"
      },
      "description": "The criteria used for policy creation"
    },
    "schedule": {
      "$ref": "#/$defs/Schedule"
    },
    "lastModifiedDate": {
      "type": "string",
      "description": "The last modification date of the policy"
    },
    "description": {
      "type": "string",
      "description": "User added description of the policy"
    },
    "recurring": {
      "type": "boolean",
      "description": "If the policy is recurring"
    },
    "recurrenceConfig": {
      "$ref": "#/$defs/RecurrenceConfigOutput"
    },
    "autoApproveLimit": {
      "type": "integer",
      "format": "int32",
      "description": "Number of entities for which policy is auto approved. Only visible if initiatorType is DASHBOARD or DATA_POLICIES"
    },
    "needsApproval": {
      "type": "boolean",
      "description": "If policy needs manual approval. Only visible if initiatorType is DASHBOARD or DATA_POLICIES"
    },
    "createdBy": {
      "type": "string",
      "format": "uuid",
      "description": "Policy creator details"
    },
    "creationDate": {
      "type": "string",
      "description": "Policy creation date"
    },
    "retentionValueInDays": {
      "type": "string",
      "description": "Retention value in days for media. Mandatory and applicable only for Change Retention policy. Possible values between 0-9999 or Indefinite."
    }
  },
  "$defs": {
    "Criteria": {
      "type": "object",
      "properties": {
        "fieldId": {
          "type": "string",
          "description": "Unique identifier for the filtering field"
        },
        "operator": {
          "type": "string",
          "description": "Comparison operator for the filtering condition"
        },
        "range": {
          "$ref": "#/$defs/Range"
        },
        "value": {
          "type": "string",
          "description": "Single value for filtering when using EQ operator"
        },
        "values": {
          "type": "array",
          "description": "List of values for filtering when using IN operator",
          "items": {
            "type": "string",
            "description": "List of values for filtering when using IN operator"
          }
        }
      },
      "description": "Criteria for filtering records"
    },
    "Range": {
      "type": "object",
      "properties": {
        "from": {
          "type": "string"
        },
        "to": {
          "type": "string"
        }
      },
      "description": "Range of values when using BETWEEN operator"
    },
    "RecurrenceConfigOutput": {
      "type": "object",
      "properties": {
        "frequency": {
          "pattern": "DAILY|WEEKLY|MONTHLY",
          "type": "string",
          "description": "Frequency of recurrence",
          "enum": [
            "DAILY",
            "WEEKLY",
            "MONTHLY"
          ]
        },
        "recurrenceEndType": {
          "pattern": "DATE|NO_OF_OCCURRENCES|NEVER",
          "type": "string",
          "description": "End type of recurrence",
          "enum": [
            "DATE",
            "NO_OF_OCCURRENCES",
            "NEVER"
          ]
        },
        "recurrenceEndDate": {
          "type": "string",
          "description": "End date of recurrence (if recurrenceEndType:DATE)"
        },
        "totalNoOfRecurrences": {
          "type": "integer",
          "description": "Total number of recurrences (if recurrenceEndType: NO_OF_OCCURRENCES )",
          "format": "int32"
        },
        "dayOfWeek": {
          "pattern": "MONDAY|TUESDAY|WEDNESDAY|THURSDAY|FRIDAY|SATURDAY|SUNDAY",
          "type": "string",
          "description": "Applicable day of the week for recurrence",
          "enum": [
            "MONDAY",
            "TUESDAY",
            "WEDNESDAY",
            "THURSDAY",
            "FRIDAY",
            "SATURDAY",
            "SUNDAY"
          ]
        },
        "dayOfMonth": {
          "maximum": 28,
          "minimum": 1,
          "type": "integer",
          "description": "Applicable day of the month for recurrence",
          "format": "int32"
        },
        "recurrenceStatus": {
          "type": "string",
          "description": "Current status of the recurrence"
        },
        "recurrenceTime": {
          "type": "string",
          "description": "Time when recurrence executes"
        }
      },
      "description": "Configuration for recurring policies"
    },
    "Schedule": {
      "type": "object",
      "properties": {
        "executeNow": {
          "type": "boolean",
          "description": "Policy is configured to execute immediately"
        }
      }
    }
  }
}