{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Root iAgree states schema.",
    "description": "iAgree v2 states JSON schema",
    "type": "object",
    "properties": {
        "agreementId": {
            "type": "string"
        },
        "stateType": {
            "type": "string"
        },
        "id": {
            "type": "string"
        },
        "period": {
            "type": "object",
            "properties": {
                "from": {
                    "type": "string"
                },
                "to": {
                    "type": "string"
                }
            },
            "required": [
                "from",
                "to"
            ]
        },
        "scope": {
            "type": "object",
            "patternProperties": {
                "^[a-zA-Z0-9]*$": {}
            }
        },
        "window": {
            "type": "object",
            "patternProperties": {
                "^[a-zA-Z0-9]*$": {}
            }
        },
        "records": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "value": {
                        "oneOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "number"
                            },
                            {
                                "type": "boolean"
                            }
                        ]
                    },
                    "time": {
                        "type": "string"
                    }
                },
                "required": [
                    "value",
                    "time"
                ]
            }
        }
    },
    "required": [
        "agreementId",
        "stateType",
        "id",
        "period",
        "scope",
        "window",
        "records"
    ]
}