{
    "title": "agent clusters",
    "id": "schemas/jobscheduler/agentClusters",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "javaType": "com.sos.joc.model.jobscheduler.AgentClusters",
    "type": "object",
    "required": [
        "deliveryDate",
        "agentClusters"
    ],
    "properties": {
        "deliveryDate": {
            "id": "schemas/common/deliveryDate",
            "description": "Current date of the JOC server/REST service. Value is UTC timestamp in ISO 8601 YYYY-MM-DDThh:mm:ss.sZ",
            "type": "string",
            "format": "date-time"
        },
        "agentClusters": {
            "type": "array",
            "items": {
                "id": "schemas/jobscheduler/agentCluster",
                "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": {
                        "id": "schemas/common/surveyDate_v",
                        "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": {
                        "id": "schemas/common/path",
                        "description": "absolute path based on live folder of a JobScheduler object.",
                        "type": "string",
                        "pattern": "/([^/]+/)*[^/]+"
                    },
                    "name": {
                        "type": "string"
                    },
                    "maxProcesses": {
                        "id": "schemas/common/nonNegativeInteger",
                        "type": "integer",
                        "minimum": 0
                    },
                    "_type": {
                        "id": "schemas/jobscheduler/agentClusterType",
                        "javaType": "com.sos.joc.model.jobscheduler.AgentClusterType",
                        "type": "string",
                        "description": "the type of agent cluster",
                        "enum": [
                            "SINGLE_AGENT",
                            "FIX_PRIORITY",
                            "ROUND_ROBIN"
                        ]
                    },
                    "state": {
                        "id": "schemas/jobscheduler/agentClusterState",
                        "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": {
                                "id": "schemas/jobscheduler/agentClusterStateText",
                                "javaType": "com.sos.joc.model.jobscheduler.AgentClusterStateText",
                                "type": "string",
                                "enum": [
                                    "ALL_AGENTS_ARE_RUNNING",
                                    "ONLY_SOME_AGENTS_ARE_RUNNING",
                                    "ALL_AGENTS_ARE_UNREACHABLE"
                                ]
                            }
                        }
                    },
                    "numOfAgents": {
                        "id": "schemas/jobscheduler/numOfAgents",
                        "type": "object",
                        "javaType": "com.sos.joc.model.jobscheduler.NumOfAgentsInCluster",
                        "required": [
                            "any",
                            "running"
                        ],
                        "properties": {
                            "any": {
                                "id": "schemas/common/nonNegativeInteger",
                                "type": "integer",
                                "minimum": 0
                            },
                            "running": {
                                "id": "schemas/common/nonNegativeInteger",
                                "type": "integer",
                                "minimum": 0
                            }
                        }
                    },
                    "agents": {
                        "type": "array",
                        "items": {
                            "id": "schemas/jobscheduler/agentOfCluster_p",
                            "javaType": "com.sos.joc.model.jobscheduler.AgentOfCluster",
                            "type": "object",
                            "required": [
                                "surveyDate",
                                "version",
                                "host",
                                "url",
                                "os",
                                "state",
                                "startedAt"
                            ],
                            "properties": {
                                "surveyDate": {
                                    "id": "schemas/common/surveyDate_p",
                                    "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": {
                                    "id": "schemas/jobscheduler/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": {
                                    "id": "schemas/jobscheduler/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": {
                                            "id": "schemas/jobscheduler/stateText",
                                            "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": {
                                    "id": "schemas/common/timestamp",
                                    "description": "Value is UTC timestamp in ISO 8601 YYYY-MM-DDThh:mm:ss.sZ or empty",
                                    "type": "string",
                                    "format": "date-time"
                                },
                                "runningTasks": {
                                    "id": "schemas/common/nonNegativeInteger",
                                    "type": "integer",
                                    "minimum": 0
                                }
                            }
                        }
                    },
                    "numOfProcesses": {
                        "id": "schemas/common/nonNegativeInteger",
                        "type": "integer",
                        "minimum": 0
                    },
                    "processes": {
                        "type": "array",
                        "items": {
                            "id": "schemas/processClass/process",
                            "javaType": "com.sos.joc.model.processClass.Process",
                            "type": "object",
                            "required": [
                                "job",
                                "taskId",
                                "pid",
                                "runningSince"
                            ],
                            "properties": {
                                "job": {
                                    "id": "schemas/common/path",
                                    "description": "absolute path based on live folder of a JobScheduler object.",
                                    "type": "string",
                                    "pattern": "/([^/]+/)*[^/]+"
                                },
                                "taskId": {
                                    "type": "string"
                                },
                                "pid": {
                                    "id": "schemas/common/nonNegativeInteger",
                                    "type": "integer",
                                    "minimum": 0
                                },
                                "runningSince": {
                                    "id": "schemas/common/timestamp",
                                    "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": {
                        "id": "schemas/common/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": {
                                "id": "schemas/common/configurationStatusText",
                                "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"
                            }
                        }
                    }
                }
            }
        }
    }
}