{
    "title": "agent cluster",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "javaType": "com.sos.joc.model.jobscheduler.AgentCluster",
    "type": "object",
    "oneOf": [
        {
            "description": "if parameter compact=false or undefined",
            "required": [
                "surveyDate",
                "path",
                "name",
                "state",
                "numOfAgents",
                "maxProcesses",
                "_type",
                "agents"
            ]
        },
        {
            "description": "response without agents collection if parameter compact=true, configurationStatus optional",
            "required": [
                "surveyDate",
                "path",
                "name",
                "state",
                "numOfAgents",
                "maxProcesses",
                "_type"
            ]
        }
    ],
    "properties": {
        "surveyDate": {
            "description": "Current date of the JobScheduler Master/Agent. Value is UTC timestamp in ISO 8601 YYYY-MM-DDThh:mm:ss.sZ",
            "type": "string",
            "format": "date-time"
        },
        "path": {
            "description": "absolute path based on live folder of a JobScheduler object.",
            "type": "string",
            "pattern": "^(/|(/[^/\\<>?:\"|*]+)+)$",
            "maxLength": 255
        },
        "name": {
            "type": "string"
        },
        "maxProcesses": {
            "type": "integer",
            "minimum": 0
        },
        "_type": {
            "javaType": "com.sos.joc.model.jobscheduler.AgentClusterType",
            "type": "string",
            "description": "the type of agent cluster",
            "enum": [
                "SINGLE_AGENT",
                "FIX_PRIORITY",
                "ROUND_ROBIN"
            ]
        },
        "state": {
            "javaType": "com.sos.joc.model.jobscheduler.AgentClusterState",
            "type": "object",
            "required": [
                "severity",
                "_text"
            ],
            "properties": {
                "severity": {
                    "description": "0=all Agents are running, 1=some Agents are unreachable but not all, 2=all Agents are unreachable",
                    "type": "integer"
                },
                "_text": {
                    "javaType": "com.sos.joc.model.jobscheduler.AgentClusterStateText",
                    "type": "string",
                    "enum": [
                        "ALL_AGENTS_ARE_RUNNING",
                        "ONLY_SOME_AGENTS_ARE_RUNNING",
                        "ALL_AGENTS_ARE_UNREACHABLE"
                    ]
                }
            }
        },
        "numOfAgents": {
            "type": "object",
            "javaType": "com.sos.joc.model.jobscheduler.NumOfAgentsInCluster",
            "required": [
                "any",
                "running"
            ],
            "properties": {
                "any": {
                    "type": "integer",
                    "minimum": 0
                },
                "running": {
                    "type": "integer",
                    "minimum": 0
                }
            }
        },
        "agents": {
            "type": "array",
            "items": {
                "javaType": "com.sos.joc.model.jobscheduler.AgentOfCluster",
                "type": "object",
                "required": [
                    "surveyDate",
                    "version",
                    "host",
                    "url",
                    "os",
                    "state",
                    "startedAt"
                ],
                "properties": {
                    "surveyDate": {
                        "description": "Date of the inventory data. Value is UTC timestamp in ISO 8601 YYYY-MM-DDThh:mm:ss.sZ",
                        "type": "string",
                        "format": "date-time"
                    },
                    "version": {
                        "type": "string"
                    },
                    "host": {
                        "type": "string"
                    },
                    "url": {
                        "description": "url can be different against host/port if agent behind a proxy",
                        "type": "string",
                        "pattern": "^https?://.+$"
                    },
                    "os": {
                        "javaType": "com.sos.joc.model.jobscheduler.OperatingSystem",
                        "type": "object",
                        "required": [
                            "name",
                            "architecture",
                            "distribution"
                        ],
                        "properties": {
                            "name": {
                                "description": "Windows, Linux, AIX, Solaris, other",
                                "type": "string"
                            },
                            "architecture": {
                                "type": "string"
                            },
                            "distribution": {
                                "description": "e.g. Windows 2012, CentOS Linux release 7.2.1511 (Core)",
                                "type": "string"
                            }
                        }
                    },
                    "state": {
                        "javaType": "com.sos.joc.model.jobscheduler.JobSchedulerState",
                        "type": "object",
                        "required": [
                            "severity",
                            "_text"
                        ],
                        "properties": {
                            "severity": {
                                "description": "0=running/starting, 1=paused, 3=waiting_for_activation/terminating, 2=waiting_for_database/dead/unreachable",
                                "type": "integer"
                            },
                            "_text": {
                                "javaType": "com.sos.joc.model.jobscheduler.JobSchedulerStateText",
                                "type": "string",
                                "enum": [
                                    "STARTING",
                                    "RUNNING",
                                    "PAUSED",
                                    "WAITING_FOR_ACTIVATION",
                                    "TERMINATING",
                                    "WAITING_FOR_DATABASE",
                                    "DEAD",
                                    "UNREACHABLE",
                                    "UNKNOWN_AGENT"
                                ]
                            }
                        }
                    },
                    "startedAt": {
                        "description": "Value is UTC timestamp in ISO 8601 YYYY-MM-DDThh:mm:ss.sZ or empty",
                        "type": "string",
                        "format": "date-time"
                    },
                    "runningTasks": {
                        "type": "integer",
                        "minimum": 0
                    }
                }
            }
        },
        "numOfProcesses": {
            "type": "integer",
            "minimum": 0
        },
        "processes": {
            "type": "array",
            "items": {
                "javaType": "com.sos.joc.model.processClass.Process",
                "type": "object",
                "required": [
                    "job",
                    "taskId",
                    "pid",
                    "runningSince"
                ],
                "properties": {
                    "job": {
                        "description": "absolute path based on live folder of a JobScheduler object.",
                        "type": "string",
                        "pattern": "^(/|(/[^/\\<>?:\"|*]+)+)$",
                        "maxLength": 255
                    },
                    "taskId": {
                        "type": "string"
                    },
                    "pid": {
                        "type": "integer",
                        "minimum": 0
                    },
                    "runningSince": {
                        "description": "Value is UTC timestamp in ISO 8601 YYYY-MM-DDThh:mm:ss.sZ or empty",
                        "type": "string",
                        "format": "date-time"
                    },
                    "agent": {
                        "description": "url",
                        "type": "string",
                        "pattern": "^https?://.+$"
                    }
                }
            }
        },
        "configurationStatus": {
            "javaType": "com.sos.joc.model.common.ConfigurationState",
            "type": "object",
            "required": [
                "severity",
                "_text"
            ],
            "properties": {
                "severity": {
                    "description": "4=ok; 5=replacement_is_standing_by,removing_delayed; 2=error_in_configuration_file,changed_file_not_loaded,resource_is_missing",
                    "type": "integer"
                },
                "_text": {
                    "javaType": "com.sos.joc.model.common.ConfigurationStateText",
                    "type": "string",
                    "enum": [
                        "ERROR_IN_CONFIGURATION_FILE",
                        "CHANGED_FILE_NOT_LOADED",
                        "REMOVING_DELAYED",
                        "RESOURCE_IS_MISSING",
                        "REPLACEMENT_IS_STANDING_BY",
                        "OK"
                    ]
                },
                "message": {
                    "description": "contains e.g. error message",
                    "type": "string"
                }
            }
        }
    }
}