{
    "additionalProperties": false,
    "description": "Schema for a PII enrichment original values",
    "properties": {
        "pii": {
            "additionalProperties": false,
            "anyOf": [
                {
                    "required": [
                        "pojo"
                    ]
                },
                {
                    "required": [
                        "json"
                    ]
                }
            ],
            "properties": {
                "json": {
                    "description": "A JSON field replacement from the EnrichedEvent POJO (e.g. contexts). Each entry in this array is a match of the jsonPath for that field",
                    "items": {
                        "properties": {
                            "fieldMapping": {
                                "additionalProperties": false,
                                "description": "A single replacement (there can be multiple) caused by specifying that JsonPath",
                                "properties": {
                                    "fieldName": {
                                        "description": "The name of the field",
                                        "enum": [
                                            "contexts",
                                            "derived_contexts",
                                            "unstruct_event"
                                        ]
                                    },
                                    "jsonPath": {
                                        "description": "The JsonPath that was specified",
                                        "type": "string"
                                    },
                                    "modifiedValue": {
                                        "description": "The modified value (e.g. hash) of the original value",
                                        "maxLength": 128,
                                        "type": "string"
                                    },
                                    "originalValue": {
                                        "description": "The original value of the field",
                                        "type": "string"
                                    },
                                    "schema": {
                                        "description": "The iglu schema corresponding to this field and value",
                                        "pattern": "^iglu:([a-zA-Z0-9-_.]+)/([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/([1-9][0-9]*|\\*)-((?:0|[1-9][0-9]*)|\\*)-((?:0|[1-9][0-9]*)|\\*)$",
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "fieldName",
                                    "jsonPath",
                                    "originalValue",
                                    "modifiedValue",
                                    "schema"
                                ],
                                "type": "object"
                            }
                        },
                        "type": "object"
                    },
                    "type": "array"
                },
                "pojo": {
                    "description": "A scalar field replacement from the EnrichedEvent POJO (e.g. user_id)",
                    "items": {
                        "additionalProperties": false,
                        "properties": {
                            "fieldName": {
                                "description": "The name of the field",
                                "enum": [
                                    "user_id",
                                    "user_ipaddress",
                                    "user_fingerprint",
                                    "domain_userid",
                                    "network_userid",
                                    "ip_organization",
                                    "ip_domain",
                                    "tr_orderid",
                                    "ti_orderid",
                                    "mkt_term",
                                    "mkt_content",
                                    "se_category",
                                    "se_action",
                                    "se_label",
                                    "se_property",
                                    "mkt_clickid",
                                    "refr_domain_userid",
                                    "domain_sessionid"
                                ]
                            },
                            "modifiedValue": {
                                "description": "The value that this field was replaced with (e.g. the hash of the original)",
                                "maxLength": 128,
                                "type": "string"
                            },
                            "originalValue": {
                                "description": "The original value (before the PII transform), of the field",
                                "type": "string"
                            }
                        },
                        "required": [
                            "fieldName",
                            "originalValue",
                            "modifiedValue"
                        ],
                        "type": "object"
                    },
                    "type": "array"
                }
            },
            "type": "object"
        },
        "strategy": {
            "additionalProperties": false,
            "description": "The strategy used to modify the original value",
            "properties": {
                "pseudonymize": {
                    "additionalProperties": false,
                    "description": "The pseudonymize strategy for modifying the original value",
                    "properties": {
                        "hashFunction": {
                            "description": "The function used to pseudonymize",
                            "enum": [
                                "MD2",
                                "MD5",
                                "SHA-1",
                                "SHA-256",
                                "SHA-384",
                                "SHA-512"
                            ]
                        }
                    },
                    "required": [
                        "hashFunction"
                    ],
                    "type": "object"
                }
            },
            "required": [
                "pseudonymize"
            ],
            "type": "object"
        }
    },
    "required": [
        "pii",
        "strategy"
    ],
    "self": {
        "format": "jsonschema",
        "name": "pii_transformation",
        "vendor": "com.snowplowanalytics.snowplow",
        "version": "1-0-0"
    },
    "type": "object"
}