# Change Control
# ===============
# Version    Date        Author         Change Description
# 1.0.0      03/09/2024  Kalpana H V    First release of new Billing APIs
#
openapi: 3.0.0
info: 
  title: Billing APIs
  version: 1.0.0
  description: This API specification defines APIs associated with retrieval of various types of CDR files & non usage reports
  contact: 
    name: Colt Reseller Support Voice
    email: ResellerSupport.Voice@colt.net
    
servers:
  - url: https://apis.colt.net/usageManagement
    description: Production server 
  - url: https://sandbox.apis.colt.net/usageManagement
    description: Sandbox server 
    
security:
  - OAuth2: []
  - bearerAuth: []
  
tags: 
  - name: "Get Rated CDRs"
  - name: "Get non usage report"
  - name: "Get Unrated CDRs"
  - name: "Generate consolidated unrated CDRs"
  - name: "Request consolidated unrated CDRs"  

paths:
  /v1/ratedCallDetailRecord:
    get:
      tags: 
        - "Get Rated CDRs"
      description: "API to retrieve rated CDR file "
      parameters:
      - name: x-tracking-id
        in: "header"
        required: true
        description: "Unique identifier for the request"        
        schema:
          $ref: '#/components/schemas/trackingIdTypeV1'
      - name: OCN
        in: "query"
        required: true
        description: "OCN associated with your request"
        schema:
          $ref: '#/components/schemas/OCNTypeV1'
      - name: BCN
        in: "query"      
        description: "BCN associated with your request"
        schema:
          $ref: '#/components/schemas/BCNTypeV1'
      - name: invoiceNumber
        in: "query"      
        description: "Invoice number associated with your request"
        schema:
          $ref: '#/components/schemas/invoiceNumberTypeV1'
      - name: month
        in: "query"
        description: "Month for which you want to download the rated CDRs"
        schema:
          $ref: '#/components/schemas/monthFormatV1'
      - name: year
        in: "query"      
        description: "Year for which you want to download the rated CDRs"
        schema:
          $ref: '#/components/schemas/yearFormatV1'
      responses:
        "200": 
          description: Success
          headers:
            Content-Type: 
              schema:
                type: string
                example: 'multipart/form-data; boundary=645501572420247968528808'
            x-tracking-id:
              description: Id to track the request end to end
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content: 
            multipart/form-data: 
              schema:            
                type: string
                format: binary                
        "400":
          description: Bad Request
          headers:          
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'              
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "401":
          description: Unauthorized
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "403":
          description: Forbidden
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "404":
          description: Not Found
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "405":
          description: Method Not allowed
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "406":
          description: Not Acceptable
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'                
        "413":
          description: Payload Too Large
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'                 
        "415":
          description: Unsupported Media Type
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1' 
        "429":
          description: Too Many Requests
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'                 
        "500":
          description: Internal Server Error
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'  
        "503":
          description: Service Unavailable
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'  
        "504":
          description: Gateway Timeout
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'  
                
  /v1/nonUsageReport:
    get:
      tags: 
        - "Get non usage report"
      description: API to get non usage report        
      parameters:
      - name: x-tracking-id
        in: "header"
        required: true
        schema:
          $ref: '#/components/schemas/trackingIdTypeV1'
      - name: OCN
        in: "query"
        required: true        
        description: "OCN associated with your request"
        schema:
          $ref: '#/components/schemas/OCNTypeV1'
      - name: BCN
        in: query
        description: "BCN associated with your request"        
        schema:
          $ref: '#/components/schemas/BCNTypeV1'
      - name: invoiceNumber
        in: query
        description: "Invoice number associated with your request"
        schema:
          $ref: '#/components/schemas/invoiceNumberTypeV1'
      - name: month
        in: "query"
        description: "Month for which you want to download the non usage report"
        schema:
          $ref: '#/components/schemas/monthFormatV1'
      - name: year
        in: "query"      
        description: "Year for which you want to download the non usage report"
        schema:
          $ref: '#/components/schemas/yearFormatV1'
      responses:
        "200": 
          description: Success
          headers:
            Content-Type: 
              schema:
                type: string
                example: 'multipart/form-data; boundary=645501572420247968528808'
            x-tracking-id:
              description: Id to track the request end to end
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content: 
            multipart/form-data: 
              schema:            
                type: string
                format: binary     
        "400":
          description: Bad Request
          headers:          
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'              
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "401":
          description: Unauthorized
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "403":
          description: Forbidden
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "404":
          description: Not Found
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "405":
          description: Method Not allowed
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "406":
          description: Not Acceptable
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'                
        "413":
          description: Payload Too Large
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'                 
        "415":
          description: Unsupported Media Type
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1' 
        "429":
          description: Too Many Requests
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'                 
        "500":
          description: Internal Server Error
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'  
        "503":
          description: Service Unavailable
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'  
        "504":
          description: Gateway Timeout
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'                                                    
    
  /v1/unratedCallDetailRecord:
    get:
      tags: 
        - "Get Unrated CDRs"
      description: API to retrieve unrated CDR file
      parameters:
      - name: x-tracking-id
        in: "header"
        required: true
        schema:
          $ref: '#/components/schemas/trackingIdTypeV1'
      - name: serviceProfile
        in: "query"      
        description: "Service frofile associated with your request"        
        required: true
        schema:
          $ref: '#/components/schemas/profileFormatV1'
      - name: productOffering
        in: query
        description: "product name associated with your request"
        required: true        
        schema: 
          $ref: '#/components/schemas/allowedProductOfferingTypeV1'
      - name: fromDate
        description: "start date from which you want to download the unrated CDRs"
        in: "query"
        required: true                
        schema:
          $ref: '#/components/schemas/dateFormatV1'
      - name: toDate
        description: "End date till which you want to download the unrated CDRs"
        in: "query"
        schema:
          $ref: '#/components/schemas/dateFormatV1'          
        
      responses:
        "200": 
          description: Success
          headers:
            Content-Type: 
              schema:
                type: string
                example: 'multipart/form-data; boundary=645501572420247968528808'
            x-tracking-id:
              description: Id to track the request end to end
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content: 
            multipart/form-data: 
              schema:            
                type: string
                format: binary
        "400":
          description: Bad Request
          headers:          
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'              
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "401":
          description: Unauthorized
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "403":
          description: Forbidden
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "404":
          description: Not Found
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "405":
          description: Method Not allowed
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "406":
          description: Not Acceptable
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'                
        "413":
          description: Payload Too Large
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'                 
        "415":
          description: Unsupported Media Type
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1' 
        "429":
          description: Too Many Requests
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'                 
        "500":
          description: Internal Server Error
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'  
        "503":
          description: Service Unavailable
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'  
        "504":
          description: Gateway Timeout
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'                                                    

  /v1/generateConsolidatedUnratedCallDetailRecord:
    post:
      tags: 
        - "Generate consolidated unrated CDRs"
      description: API to initiate consolidated unrated CDR file generation
      parameters:
      - name: x-tracking-id
        in: "header"
        required: true
        schema:
          $ref: '#/components/schemas/trackingIdTypeV1'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/consolidatedCDRRequest'          

      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/asyncResponseType'
          headers:
            x-tracking-id:
              description: Id to track the request end to end
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                
            Content-Type: 
              schema:
                type: string
                enum:
                  - application/json              

        "400":
          description: Bad Request
          headers:          
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'              
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "401":
          description: Unauthorized
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "403":
          description: Forbidden
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "404":
          description: Not Found
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "405":
          description: Method Not allowed
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "406":
          description: Not Acceptable
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'                
        "413":
          description: Payload Too Large
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'                 
        "415":
          description: Unsupported Media Type
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1' 
        "429":
          description: Too Many Requests
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'                 
        "500":
          description: Internal Server Error
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'  
        "503":
          description: Service Unavailable
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'  
        "504":
          description: Gateway Timeout
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'                                                    

                                   
  /v1/consolidatedUnratedCallDetailRecord:
    get:
      tags: 
        - "Request consolidated unrated CDRs"
      description: API to get actual consolidated unrated CDR file
      parameters:
      - name: x-tracking-id
        in: "header"
        required: true
        schema:
          $ref: '#/components/schemas/trackingIdTypeV1'
      - name: serviceProfile
        in: "query"
        description: "Service frofile associated with your request"
        required: true
        schema:
          $ref: '#/components/schemas/profileFormatV1'
      - name: orderId
        in: query
        description: "OrderID received to request for consolidated unrated CDRs"        
        required: true
        schema: 
          $ref: '#/components/schemas/orderIdTypeV1'   

      responses:
        "200": 
          description: Success
          headers:
            Content-Type: 
              schema:
                type: string
                enum:
                  - application/x-gzip
            x-tracking-id:
              description: Id to track the request end to end
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
            Content-Disposition:
              schema:
                type: string
              example: attachment; name="RO_Non Usage CDR_100271358_221067_2021721000023-R.gz"
            x-content-type-options: 
              schema:
                type: string
              example: nosniff 
          content:
            application/x-gzip:
              schema:
                type: string
                format: binary                
        "400":
          description: Bad Request
          headers:          
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'              
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "401":
          description: Unauthorized
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "403":
          description: Forbidden
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "404":
          description: Not Found
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "405":
          description: Method Not allowed
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'
        "406":
          description: Not Acceptable
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'                
        "413":
          description: Payload Too Large
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'                 
        "415":
          description: Unsupported Media Type
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1' 
        "429":
          description: Too Many Requests
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'                 
        "500":
          description: Internal Server Error
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'                                                  
          content:
            application/json:          
              schema:
                $ref: '#/components/schemas/errorTypeV1'  
        "503":
          description: Service Unavailable
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'  
        "504":
          description: Gateway Timeout
          headers:
            x-exception-system: 
              schema:
                $ref: '#/components/schemas/exceptionSystemTypeV1'
            x-tracking-id:
              description: "Unique identifier for the request"
              schema: 
                $ref: '#/components/schemas/trackingIdTypeV1'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorTypeV1'                                                    
components:
  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://apis.colt.net/authentication/v1/oauth/token
          scopes: {}

    bearerAuth:            
      type: http
      scheme: bearer
      bearerFormat: JWT 
      
  schemas:
    monthFormatV1:
      type: string
      enum:
        - 'Jan'
        - 'Feb'
        - 'Mar'
        - 'Apr'
        - 'May'
        - 'Jun'
        - 'Jul'
        - 'Aug'
        - 'Sep'
        - 'Oct'
        - 'Nov'
        - 'Dec'

    yearFormatV1:        
      type: string
      pattern: "^[0-9]{4}$"
      example: '2021'

    dateFormatV1:
      type: string
      format: date
      description: date time in ISO 8601 format      
      example: "2019-05-17"     

    asyncResponseType:
      type: object
      properties:
        order:
          type: object
          properties:
            orderId:
              $ref: '#/components/schemas/orderIdTypeV1'      


    orderIdTypeV1:
      type: string
      pattern: "^[A-Za-z0-9\\-]{1,36}$"
      example: "2023092012"
      
    profileFormatV1:
      type: string
      maxLength: 3       
      example: "ANH"
      description: "Service frofile associated with your request"        
          
    allowedProductOfferingTypeV1:
      type: string
      description: "product name associated with your request"
      enum:
        - 'Voice Line'
        - 'SIP Trunking'
        - 'IP Voice Line'
        - 'IN For Resellers'
        - 'Wholesale SIP'
        - 'CIC for Resellers'
        - 'CIC Opc Reseller'
    
    OCNTypeV1:
      type: string
      pattern: "^[A-Za-z0-9]*$"
      maxLength: 20
      example: "A12345678"
      
    BCNTypeV1:
      type: string
      pattern: "^[A-Za-z0-9]*$"
      maxLength: 20
      example: "12345678"
      
    consolidatedCDRRequest:
      type: object
      required:
        - serviceProfile
        - productOffering
        - fromDate
        - toDate
      properties:
        serviceProfile:
          $ref: '#/components/schemas/profileFormatV1'   
        productOffering: 
          $ref: '#/components/schemas/allowedProductOfferingTypeV1'          
        fromDate:
          $ref: '#/components/schemas/dateFormatV1'
        toDate:
          $ref: '#/components/schemas/dateFormatV1'
          
    trackingIdTypeV1: 
      type: string
      description: "Unique identifier for the request"
      example: abcd456e-d45645-dfaafda-1232345667dd
      pattern: "^[a-zA-Z0-9_.~:@-]{1,255}$"
      maxLength: 255
      
    invoiceNumberTypeV1:
      type: string
      maxLength: 255
      example: "2025366010624"

    exceptionSystemTypeV1:
      type: string
      enum:
        - 'APIGW'
        - 'OMS'
        - 'IMS'
        - 'COL_API'

    errorTypeV1:
      description: 'Used when an API throws an Error, typically with a HTTP error response-code (3xx, 4xx, 5xx)'
      type: object
      required:
        - code
        - reason
      properties:
        code:
          type: string
          description: 'Application relevant detail, defined in the API or a common list.'
          example: ERR01
        reason:
          type: string
          description: Explanation of the reason for the error which can be shown to a client user.
        message:
          type: string
          description: More details and corrective actions related to the error which can be shown to a client user.