{       
    "id" : "transportController.json",
    "title" : "API to access the transportControllers",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "$ref" : "#/definitions/transportControllerList",
    "links" : [
	{
	    "title" : "get all transport controllers",
	    "href" : "/",
	    "method" : "GET",
	    "rel" : "instances",
	    "schema" : {"$ref" : "#/definitions/transportControllerList"}
	},
	{
	    "title" : "get a specific transportController",
	    "href" : "/{transportControllerIndex}",
	    "method" : "GET",
	    "rel" : "self",
	    "schema" : {"$ref" : "#/definitions/transportController"}
	},
	{
	    "title" : "create a new transportController",
	    "description" : "Create a new transportController, schema on request is #/definitions/createTransportController",
	    "href" : "/",
	    "method" : "POST",
	    "rel" : "create",
            "schema" : {"$ref" : "#/definitions/createTransportController"},
	    "targetSchema" : {
		"$ref" : "#/definitions/transportController",
		"required" : ["name"]
	    }            
	},
	{
	    "title" : "update a transportController",
	    "href" : "/{transportControllerIndex}",
	    "description" : "Update an existing transportController, schema on request is #/definitions/updateTransportController",
	    "method" : "PUT",
	    "rel" : "self",	    
	    "schema" : {"$ref" : "#/definitions/updateTransportController"}
	},
	{
	    "title" : "delete a transportController",
	    "href" : "/{transportControllerIndex}",	    
	    "method" : "DELETE"
	}
    ],
    "definitions" : {
	"updateTransportController" : {
	    "$ref" : "#/definitions/transportController"
	},
	"createTransportController" : {
	    "description" : "POST parameters for a transport controller, the transportControllerIndex property must not be set  ",
	    "name" : "transportController",
            "type" : "object",
	    "required" : ["topoObjectType","profileName","name"],
	    "additionalProperties" : false,
            "properties": {
		"topoObjectType" : {"type" : "string","enum" : ["transportController"]},
                "name": {
                    "description": "identifier of the transport controller, which is fixed on creation and cannot be updated",
                    "type" :"string",
                    "maxLength" : 255,
                    "minLength" : 1
                },
		"interfaceType"         : {"type" : "string",  "description" : "The type of interface. Some controller do not offer RESTCONF access and need vendor-specific adapters", "enum" : ["RESTCONF","REST","CIENA-REST","VIRTUORA-REST"], "default" : "RESTCONF"}, 
		"notifyUrl"             : {"type" : "string",  "description" : "The URL for getting SSE for updates.","default" : "/restconf/STREAM"}, 
		"pollUrl"               : {"type" : "string",  "description" : "The URL that is checked  for controller liveliness detection.","default":"/.well-known/host-meta"}, 
		"profileName"           : {"type" : "string",  "description" : "The profile Name for use to get the device IPs. "}, 
		"reconnectTimeout"      : {"type" : "integer", "description" : "Interval in seconds before reconnecting to the next transport controller instance.", "minimum" : 1} ,
		"rootUrl"               : {"type" : "string",  "description" : "Root URL for the Data models.","default":"/restconf/"}, 
		"srlgPrefix"            : {"type" : "string",  "description" : "The generated facility prefix for the SRLGs, by default the controller name."}, 
		"topologyToUse"         : {
			"type" : "string",  "description" : "If several topologies are present in the transport controller, this parameter indicates which one is to be used as source of information for the IP layer.",
			"pattern": "^$|\\S+"
		},
		"topologyUrl"           : {"type" : "string",  "description" : "The URL to retrieve the transport topology.","default":"/restconf/data/ietf-te-topology:te-topologies-state"},
		"topologyModel"         : {"type" : "string",  "description" : "The type of data model.", "enum" : ["ietf-te-topology-01","OpenROADM-2.0", "TAPI-2.1"], "default" : "ietf-te-topology-01"},
		"serviceUrl"            : {"type" : "string",  "description" : "The URL to retrieve the service topology in case of OpenROADM-2.0 model.","default":"/restconf/data/org-openroadm-service:service-list"}
            },
	    "oneOf":[
		{
		    "properties":{
			"topologyModel":{"enum":["OpenROADM-2.0"]},
			"serviceUrl": {"type" : "string", "minLength" : 1}
		    },
		    "required":["serviceUrl"]
		},
		{
		    "properties":{
			"topologyModel":{"enum":["ietf-te-topology-01"]}
		    }
		},
		{
		    "properties":{
			"topologyModel":{"enum":["TAPI-2.1"]},
		        "interfaceType":{"enum" : ["RESTCONF","CIENA-REST","VIRTUORA-REST"]}
		    }
		}
	    ]
	},
        "transportController" : {
            "description" : "Represent a single transportController",
	    "name" : "transportController",
            "type" : "object",
	    "required" : ["transportControllerIndex","topoObjectType"],
            "properties": {
		"topoObjectType" : {"type" : "string","enum" : ["transportController"]},
		"transportControllerIndex" : {"$ref" : "common.json#/definitions/index"},
                "name": {
                    "description": "identifier of the transport controller, which is fixed on creation and cannot be updated",
                    "type" :"string",
                    "maxLength" : 255,
                    "minLength" : 1
                },
		"notifyUrl"             : {"type" : "string",  "description" : "The URL for getting SSE for updates.","default" : "/restconf/STREAM"}, 
		"pollUrl"               : {"type" : "string",  "description" : "The URL that is checked  for controller liveliness detection.","default":"/.well-known/host-meta"}, 
		"profileName"           : {"type" : "string",  "description" : "The profile Name to use to get the device IPs. "}, 
		"reconnectTimeout"      : {"type" : "integer", "description" : "Interval in seconds before reconnecting to the next transport controller instance.", "minimum" : 1} ,
		"rootUrl"               : {"type" : "string",  "description" : "Root URL for the Data models.","default":"/restconf/"}, 
		"srlgPrefix"            : {"type" : "string",  "description" : "The generated facility prefix for the SRLGs, by default the controller name."}, 
		"topologyToUse"         : {
			"type" : "string",  "description" : "If several topologies are present in the transport controller, this parameter indicates which one is to be used as source of information for the IP layer.",
			"pattern": "^$|\\S+"
		},
		"topologyUrl"           : {"type" : "string",  "description" : "The URL to retrieve the transport topology.","default":"/restconf/data/ietf-te-topology:te-topologies-state"},
		"topologyModel"         : {"type" : "string",  "description" : "The type of data model.", "enum" : ["ietf-te-topology-01","OpenROADM-2.0","TAPI-2.1"], "default" : "ietf-te-topology-01"},
		"serviceUrl"            : {"type" : "string",  "description" : "The URL to retrieve the service topology in case of OpenROADM-2.0 model.","default":"/restconf/data/org-openroadm-service:service-list"}
            },
	    "oneOf":[
		{
		    "properties":{
			"topologyModel":{"enum":["OpenROADM-2.0"]},
		        "interfaceType":{"type" : "string",  "description" : "The type of interface.", "enum" : ["RESTCONF","REST"], "default" : "RESTCONF"}, 
			"serviceUrl": {"type" : "string", "minLength" : 1}
		    },
		    "required":["serviceUrl"]
		},
		{
		    "properties":{
			"topologyModel":{"enum":["ietf-te-topology-01"]},
		        "interfaceType":{"type" : "string",  "description" : "The type of interface.", "enum" : ["RESTCONF","REST"], "default" : "RESTCONF"}
		    }
		},
		{
		    "properties":{
			"topologyModel":{"enum":["TAPI-2.1"]},
		        "interfaceType":{"type" : "string",  "description" : "The type of interface.","enum" : ["RESTCONF","CIENA-REST","VIRTUORA-REST"]}
		    }
		}
	    ]
        },
	"transportControllerList" : {
	    "type" : "array",
	    "items" : {"$ref" : "#/definitions/transportController"}	    
	}
    }  
}
