{
  "swagger" : "2.0",
  "info" : {
    "description" : "### TMF635 Usage Management\nSigScale OCS uses the TM Forum 635 API for usage events. Usages of a specific types and/or usages associated with a particular Service identifier may be retrieved. A date/time range for should be provided in detail queries as events are stored in sequential disk logs. Usage event notifications may be subscribed to for realtime delivery.  \n",
    "version" : "1.0.0",
    "title" : "Usage Management"
  },
  "basePath" : "/usageManagement/v1/",
  "schemes" : [ "http", "https" ],
  "consumes" : [ "application/json" ],
  "produces" : [ "application/json" ],
  "tags" : [ {
    "name" : "usage",
    "description" : "Operations on usage entities."
  }, {
    "name" : "usageSpecification",
    "description" : "Operations on usage speciofications."
  } ],
  "paths" : {
    "/usage" : {
      "get" : {
        "tags" : [ "usage" ],
        "operationId" : "listUsage",
        "summary" : "List usages",
        "description" : "List usage entities in the collection.",
        "deprecated" : false,
        "parameters" : [ {
          "name" : "type",
          "in" : "query",
          "description" : "Type of usages to list.",
          "required" : true,
          "type" : "string"
        } ],
        "responses" : {
          "200" : {
            "description" : "Usage",
            "schema" : {
              "type" : "array",
              "items" : {
                "$ref" : "#/definitions/Usage"
              }
            }
          },
          "404" : {
            "description" : "Not Found"
          },
          "500" : {
            "description" : "Internal Server Error"
          }
        }
      }
    },
    "/usage/{usageId}" : {
      "get" : {
        "tags" : [ "usage" ],
        "operationId" : "getUsage",
        "summary" : "Retrieve usage",
        "description" : "Retrieve a usage entity by ID.",
        "deprecated" : false,
        "parameters" : [ {
          "name" : "usageId",
          "in" : "path",
          "required" : true,
          "type" : "string"
        }, {
          "name" : "fields",
          "in" : "query",
          "required" : false,
          "description" : "Limit attributes in response.",
          "type" : "string"
        } ],
        "responses" : {
          "200" : {
            "description" : "Usage",
            "schema" : {
              "$ref" : "#/definitions/Usage"
            }
          },
          "400" : {
            "description" : "Bad Request"
          },
          "404" : {
            "description" : "Not Found"
          },
          "500" : {
            "description" : "Internal Server Error"
          }
        }
      }
    },
    "/hub" : {
      "post" : {
        "operationId" : "createSubscription",
        "summary" : "Create subscription",
        "description" : "Creates a subscription to event notifications.",
        "tags" : [ "eventsSubscription" ],
        "parameters" : [ {
          "name" : "data",
          "schema" : {
            "$ref" : "#/definitions/EventSubscriptionInput"
          },
          "required" : true,
          "in" : "body",
          "description" : "Data containing the callback endpoint to deliver the information."
        } ],
        "responses" : {
          "201" : {
            "description" : "Subscribed",
            "schema" : {
              "$ref" : "#/definitions/EventSubscriptionInput"
            }
          },
          "400" : {
            "description" : "Bad Request"
          },
          "401" : {
            "description" : "Unauthorized"
          }
        }
      }
    },
    "/hub/{id}" : {
      "delete" : {
        "tags" : [ "eventsSubscription" ],
        "parameters" : [ {
          "name" : "id",
          "in" : "path",
          "required" : true,
          "type" : "string",
          "description" : "identity of the subscriber"
        } ],
        "operationId" : "deleteSubscriber",
        "summary" : "This operation deletes a 'subscriber' by Id",
        "deprecated" : false,
        "responses" : {
          "204" : {
            "description" : "Success"
          },
          "400" : {
            "description" : "Bad Request"
          },
          "404" : {
            "description" : "Not Found"
          },
          "500" : {
            "description" : "Internal Server Error"
          }
        }
      }
    },
    "/usageSpecification" : {
      "get" : {
        "tags" : [ "usageSpecification" ],
        "operationId" : "listUsageSpecifications",
        "summary" : "List usage specifications",
        "description" : "List usage specifications in the collection.",
        "deprecated" : false,
        "parameters" : [ ],
        "responses" : {
          "200" : {
            "description" : "UsageSpecifications",
            "schema" : {
              "type" : "array",
              "items" : {
                "$ref" : "#/definitions/UsageSpecification"
              }
            }
          },
          "404" : {
            "description" : "Not Found"
          },
          "500" : {
            "description" : "Internal Server Error"
          }
        }
      }
    },
    "/usageSpecification/{Id}" : {
      "get" : {
        "tags" : [ "usageSpecification" ],
        "operationId" : "getUsageSpecification",
        "summary" : "Retrieve usage specification",
        "description" : "Retrieve a usage specification by ID.",
        "deprecated" : false,
        "parameters" : [ {
          "name" : "Id",
          "in" : "path",
          "required" : true,
          "type" : "string"
        } ],
        "responses" : {
          "200" : {
            "description" : "Success",
            "schema" : {
              "$ref" : "#/definitions/UsageSpecification"
            }
          },
          "400" : {
            "description" : "Bad Request"
          },
          "404" : {
            "description" : "Not Found"
          },
          "500" : {
            "description" : "Internal Server Error"
          }
        }
      }
    }
  },
  "definitions" : {
    "Usage" : {
      "description" : "A usage is an occurrence of employing a Product, Service or Resource for its intended purpose which is of interest to the business and can have charges applied to it.",
      "type" : "object",
      "properties" : {
        "id" : {
          "type" : "integer",
          "format" : "int64"
        },
        "href" : {
          "type" : "string"
        },
        "date" : {
          "type" : "string",
          "format" : "date-time"
        },
        "type" : {
          "type" : "string"
        },
        "description" : {
          "type" : "string"
        },
        "status" : {
          "type" : "string",
          "enum" : [ "Received", "Rejected", "Recycled", "Guided", "Rated", "Rerate", "Billed" ]
        },
        "usageSpecification" : {
          "$ref" : "#/definitions/UsageSpecificationRef"
        },
        "usageCharacteristic" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/UsageCharacteristic"
          }
        },
        "relatedParty" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/Reference"
          }
        },
        "ratedProductUsage" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/RatedProductUsage"
          }
        }
      }
    },
    "UsageSpecificationRef" : {
      "$ref" : "#/definitions/Reference"
    },
    "UsageSpecification" : {
      "description" : "Description of the characteristics, attributes and relationships of a type of usage.",
      "type" : "object",
      "properties" : {
        "id" : {
          "type" : "integer",
          "format" : "int64"
        },
        "href" : {
          "type" : "string"
        },
        "name" : {
          "type" : "string"
        },
        "description" : {
          "type" : "string"
        },
        "validFor" : {
          "$ref" : "#/definitions/ValidFor"
        },
        "usageSpecCharacteristic" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/UsageSpecCharacteristic"
          }
        }
      }
    },
    "RatedProductUsage" : {
      "description" : "An occurence of a product usage with details of applied rating.",
      "type" : "object",
      "properties" : {
        "ratingDate" : {
          "type" : "string",
          "format" : "date-time"
        },
        "usageRatingTag" : {
          "type" : "string"
        },
        "isBilled" : {
          "type" : "boolean"
        },
        "ratingAmountType" : {
          "type" : "string"
        },
        "taxIncludedRatingAmount" : {
          "type" : "number",
          "format" : "float"
        },
        "taxExcludedRatingAmount" : {
          "type" : "number",
          "format" : "float"
        },
        "taxRate" : {
          "type" : "number",
          "format" : "float"
        },
        "isTaxExempt" : {
          "type" : "boolean"
        },
        "offerTariffType" : {
          "type" : "string"
        },
        "bucketValueConvertedInAmount" : {
          "type" : "number",
          "format" : "float"
        },
        "currencyCode" : {
          "type" : "string"
        },
        "productRef" : {
          "type" : "string"
        }
      }
    },
    "Reference" : {
      "type" : "object",
      "properties" : {
        "id" : {
          "type" : "string"
        },
        "href" : {
          "type" : "string"
        },
        "role" : {
          "type" : "string"
        }
      }
    },
    "UsageCharacteristic" : {
      "type" : "object",
      "properties" : {
        "name" : {
          "type" : "string"
        },
        "value" : {
          "type" : "string"
        }
      }
    },
    "UsageSpecCharacteristic" : {
      "type" : "object",
      "properties" : {
        "name" : {
          "type" : "string"
        },
        "description" : {
          "type" : "string"
        },
        "configurable" : {
          "type" : "boolean"
        },
        "usageSpecCharacteristicValue" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/UsageSpecCharacteristicValue"
          }
        }
      }
    },
    "UsageSpecCharacteristicValue" : {
      "type" : "object",
      "properties" : {
        "valueType" : {
          "type" : "string"
        },
        "default" : {
          "type" : "boolean"
        },
        "value" : {
          "type" : "string"
        },
        "valueFrom" : {
          "type" : "string"
        },
        "valueTo" : {
          "type" : "string"
        }
      }
    },
    "ValidFor" : {
      "type" : "object",
      "properties" : {
        "startDateTime" : {
          "type" : "string",
          "format" : "date-time"
        },
        "endDateTime" : {
          "type" : "string",
          "format" : "date-time"
        }
      }
    },
    "EventSubscriptionInput" : {
      "description" : "Describes an event subscription including the callback URI of a listener to receive event notifications.",
      "type" : "object",
      "properties" : {
        "callback" : {
          "description" : "The callback being registered.",
          "type" : "string"
        },
        "query" : {
          "description" : "Query string used to select events."
        }
      },
      "required" : [ "callback" ]
    }
  }
}