openapi: 3.0.3
info:
  title: MasPortability API
  description: I am the MasPortability API.
  termsOfService: 'https://swagger.io/tools/swaggerhub/'
  contact:
    name: Squad Provision
  license:
    name: Apache 2.0
    url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
  version: 1.0.0
externalDocs:
  description: 'Find out more about MasPortability'
  url: 'https://mmsistemas.atlassian.net/wiki/spaces/SIS/pages/1355088054/+Protability'

tags:
  - name: Fixed portabilities
    description: Access to portabilities
  - name: Fixed migrations
    description: Access to migrations
  - name: Fixed acquisitions
    description: Access to acquisitions data
  - name: Fixed operations
    description: Access to operations on the portabilities
  - name: Fixed producers
    description: Producer in kafka
  - name: Fixed impersonate
    description: Impersonate of events generated by the E.R.
servers:
  # Public Servers
  - url: https://mas-portability.sta.masstack.com/v3
    description: STA
  - url: https://mas-portability.masstack.com/v3
    description: PROD
paths:
  /orgs/{orgId}/fixed/windowDate:
    get:
      tags:
        - Fixed portabilities
      summary: Get minimum UTC portability windowDate
      description: Get minimum portability windowDate in UTC format
      operationId: getPortabilityWindowDate
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
        - name: processType
          in: query
          description: "processType of the portability wanted to get the minimum windowDate. Default if missing is 15"
          required: false
          schema:
            type: string
            example: "15"
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/minimumWindowDate'
        '400':
          description: Invalid parameter supplied
          content: { }

  /orgs/{orgId}/fixed/portabilityByPhonenumber/{phonenumber}:
    get:
      tags:
        - Fixed portabilities
      summary: Get last portability by phonenumber
      description: Get last portability by phonenumber
      operationId: getLastPortabilityByPhonenumber
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
        - name: phonenumber
          in: path
          description: "The cli phonenunber"
          required: true
          schema:
            type: string
            pattern: '^[89]\d{8}$'
            example: "900000000"
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilityInfo'
        '400':
          description: Invalid parameters supplied
          content: {}
        '404':
          description: Portability not found
          content: {}
        '405':
          description: Validation exception
          content: {}

  /orgs/{orgId}/fixed/portabilitiesByPhonenumber/{phonenumber}:
    get:
      tags:
        - Fixed portabilities
      summary: Get portabilities by phonenumber
      description: Get portabilities by phonenumber
      operationId: getPortabilitiesByPhonenumber
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
        - name: phonenumber
          in: path
          description: "The cli phonenunber"
          required: true
          schema:
            type: string
            pattern: '^[89]\d{8}$'
            example: "900000000"
        - name: filters
          in: query
          description: "Typical filters: donorOperator, recipientRol, messageType, processType, ..."
          required: false
          schema:
            type: string
            example: "donorOperator='00031' AND recipientRol=false AND messageType IN ('DSP1', 'DSP2')"
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilitiesInfo'
        '400':
          description: Invalid parameters supplied
          content: {}
        '404':
          description: Portability not found
          content: {}
        '405':
          description: Validation exception
          content: {}

  /orgs/{orgId}/fixed/portabilitiesByExternalReference/{externalReference}:
    get:
      tags:
        - Fixed portabilities
      summary: Get portabilities by external reference
      description: Get portabilities by external reference
      operationId: getPortabilitiesByExternalReference
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
        - name: externalReference
          in: path
          description: "The external reference"
          required: true
          schema:
            type: string
            pattern: '^[A-Za-z0-9_\-]{6,255}$'
            example: "MYSIM_1234567"
        - name: filters
          in: query
          description: "Typical filters: externalReference, recipientRol, messageType, processType, ..."
          required: false
          schema:
            type: string
            example: "donorOperator='00031' AND recipientRol=false AND messageType IN ('DSP1', 'DSP2')"
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilitiesInfo'
        '400':
          description: Invalid parameters supplied
          content: {}
        '404':
          description: Portability not found
          content: {}
        '405':
          description: Validation exception
          content: {}

  /orgs/{orgId}/fixed/portabilitiesByProcessId/{processId}:
    get:
      tags:
        - Fixed portabilities
      summary: Get portability by processId
      description: Get portability by processId
      operationId: getPortabilityByProcessId
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
        - name: processId
          in: path
          description: "The Portanet identificator"
          required: true
          schema:
            type: string
            pattern: '^\d{20}$'
            example: "00031202006011500001"
        - name: filters
          in: query
          description: "Typical filters: externalReference, recipientRol, messageType, processType, ..."
          required: false
          schema:
            type: string
            example: "donorOperator='00031' AND recipientRol=false AND messageType IN ('DSP1', 'DSP2')"
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilitiesInfo'
        '400':
          description: Invalid parameters supplied
          content: {}
        '404':
          description: Portability not found
          content: {}
        '405':
          description: Validation exception
          content: {}

  /orgs/{orgId}/fixed/portabilitiesByDate/{dateField}/{dateValue}:
    get:
      tags:
        - Fixed portabilities
      summary: Get all portabilities for a date
      description: Get all portabilities for a date
      operationId: getPortabilitiesByDate
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
        - name: dateField
          in: path
          description: "The date field to filter: requestDate, messageDate, windowDate or cancellationDate"
          required: true
          schema:
            type: string
            example: "windowDate"
        - name: dateValue
          in: path
          description: "The value date"
          required: true
          schema:
            type: string
            format: date
            example: "2020-01-01"
        - name: filters
          in: query
          description: "Typical filters: externalReference, recipientRol, messageType, processType, ..."
          required: false
          schema:
            type: string
            example: "donorOperator='00031' AND recipientRol=false AND messageType IN ('DSP1', 'DSP2')"
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilitiesInfo'
        '400':
          description: Invalid parameters supplied
          content: {}
        '404':
          description: Portability not found
          content: {}
        '405':
          description: Validation exception
          content: {}

  /orgs/{orgId}/fixed/recipient/portabilityByPhonenumber/{phonenumber}:
    get:
      tags:
        - Fixed portabilities
      summary: Get last recipient portability by phonenumber
      description: Get last recipient portability by phonenumber
      operationId: getLastRecipientPortabilityByPhonenumber
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
        - name: phonenumber
          in: path
          description: "The cli phonenunber"
          required: true
          schema:
            type: string
            pattern: '^[89]\d{8}$'
            example: "900000000"
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilityInfo'
        '400':
          description: Invalid parameters supplied
          content: {}
        '404':
          description: Portability not found
          content: {}
        '405':
          description: Validation exception
          content: {}

  /orgs/{orgId}/fixed/donor/portabilityByPhonenumber/{phonenumber}:
    get:
      tags:
        - Fixed portabilities
      summary: Get last donor portability by phonenumber
      description: Get last donor portability by phonenumber
      operationId: getLastDonorPortabilityByPhonenumber
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
        - name: phonenumber
          in: path
          description: "The cli phonenunber"
          required: true
          schema:
            type: string
            pattern: '^[89]\d{8}$'
            example: "900000000"
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilityInfo'
        '400':
          description: Invalid parameters supplied
          content: { }
        '404':
          description: Portability not found
          content: { }
        '405':
          description: Validation exception
          content: { }

  /orgs/{orgId}/fixed/causesByCode/{causeCode}:
    get:
      tags:
        - Fixed portabilities
      summary: Get cause by cause code
      description: get cause by cause code
      operationId: getCausesByCode
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
        - name: causeCode
          in: path
          description: "Cause code"
          required: true
          schema:
            type: string
            pattern: '^\d{4}$'
            example: "0012"
      responses:
        '200':
          description: successful cause
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/causes'
        '404':
          description: Cause not found
          content: {}
        '405':
          description: Validation exception
          content: {}

  /orgs/{orgId}/fixed/causesByMessageType/{messageType}:
    get:
      tags:
        - Fixed portabilities
      summary: Get causes by message type
      description: get causes by message type
      operationId: getCausesByMessageType
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
        - name: messageType
          in: path
          description: "Message type"
          required: true
          schema:
            type: string
            pattern: '^.{1,5}$'
            example: "W"
      responses:
        '200':
          description: successful causes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/causes'
        '404':
          description: Causes not found for message type
          content: {}
        '405':
          description: Validation exception
          content: {}

  /orgs/{orgId}/fixed/holidayCalendar/{year}:
    get:
      tags:
        - Fixed portabilities
      summary: Get holiday calendar by year
      description: get all holidays for a given year
      operationId: holidayCalendar
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
        - name: year
          in: path
          description: "the year to get the holidays calendar"
          required: true
          schema:
            type: string
            pattern: '^\d{4}$'
            example: "2020"
      responses:
        '200':
          description: successful call
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/holidayCalendar'
        '400':
          description: validation exception
          content: {}

  /orgs/{orgId}/fixed/isHoliday/{dateValue}:
    get:
      tags:
        - Fixed portabilities
      summary: Get is holiday date
      description: get is holiday day
      operationId: isHoliday
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
        - name: dateValue
          in: path
          description: "The value date"
          required: true
          schema:
            type: string
            format: date
            example: "2020-01-01"
      responses:
        '200':
          description: successful call
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/holiday'
        '400':
          description: Validation exception
          content: {}
  /orgs/{orgId}/fixed/migrationsByDate/{dateField}/{dateValue}:
    get:
      tags:
        - Fixed migrations
      summary: Get all migrations for a date
      description: Get all migrations for a date
      operationId: getMigrationsByDate
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
        - name: dateField
          in: path
          description: "The date field to filter: requestDate, windowDate"
          required: true
          schema:
            type: string
            example: "requestDate"
        - name: dateValue
          in: path
          description: "The value date"
          required: true
          schema:
            type: string
            format: date
            example: "2020-01-01"
        - name: filters
          in: query
          description: "Typical filters: recipientRol, donorOperator ..."
          required: false
          schema:
            type: string
            example: "donorOperator='00031' AND recipientRol=false"
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: 'migration/swagger.yml#/components/schemas/migrationsInfo'
        '400':
          description: Invalid parameters supplied
          content: {}
        '404':
          description: Portability not found
          content: {}
        '405':
          description: Validation exception
          content: {}

  /orgs/{orgId}/fixed/acquisitionStatus:
    get:
      tags:
        - Fixed acquisitions
      summary: Get acquisition status description
      description: get acquisitiostatus description
      operationId: getAcquisitionStatus
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/acquisitionStatus'
        '404':
          description: Operators not found
          content: {}

  /orgs/{orgId}/fixed/acquisitionDate:
    get:
      tags:
        - Fixed acquisitions
      summary: Get acquisition files last modified date
      description: get acquisition files last modified date
      operationId: getAcquisitionDate
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/acquisitionDate'
        '404':
          description: Operators not found
          content: {}

  /orgs/{orgId}/fixed/operators:
    get:
      tags:
        - Fixed acquisitions
      summary: Get list of all operators
      description: get list of all operators
      operationId: getOperators
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/operator'
        '404':
          description: Operators not found
          content: {}

  /orgs/{orgId}/fixed/operator/{operatorId}:
    get:
      tags:
        - Fixed acquisitions
      summary: Get operator by id
      description: get operator by id
      operationId: getOperator
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
        - name: operatorId
          in: path
          description: "The operator id"
          required: true
          schema:
            type: string
            pattern: '^\d{5}$'
            example: "00031"
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/operator'
        '404':
          description: Operator not found
          content: {}
        '405':
          description: Validation exception
          content: {}

  /orgs/{orgId}/fixed/ownerOperator/{phonenumber}:
    get:
      tags:
        - Fixed acquisitions
      summary: Get the phonenumber owner
      description: get the phonenumber owner
      operationId: getOwnerOperator
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
        - name: phonenumber
          in: path
          description: "The phonenumber"
          required: true
          schema:
            type: string
            pattern: '^\d{9,15}$'
            example: "911111111"
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ownerOperator'
        '404':
          description: Phonenumber not found
          content: {}
        '405':
          description: Validation exception
          content: {}

  /orgs/{orgId}/fixed/donorPortabilities:
    get:
      tags:
        - Fixed operations
      summary: Get all pendding donor portabilities
      description: Get all pendding donor portabilities
      operationId: getDonorPortabilities
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
        - name: filters
          in: query
          description: "Typical filters: externalReference, recipientRol, messageType, processType, ..."
          required: false
          schema:
            type: string
            example: "donorOperator='00031' AND recipientRol=false AND messageType IN ('DSP1', 'DSP2')"
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilitiesInfo'
        '400':
          description: Invalid parameters supplied
          content: {}
        '404':
          description: Portability not found
          content: {}
        '405':
          description: Validation exception
          content: {}

  /orgs/{orgId}/fixed/acceptDonorPortability:
    post:
      tags:
        - Fixed operations
      summary: Accept donor portability
      description: accept donor portability
      operationId: acceptDonorPortability
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/acceptDonorPortabilityRequest'
      responses:
        '200':
          description: Accept ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilityInfo'
        '400':
          description: Invalid body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
        '404':
          description: Portability not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
        '405':
          description: Portability is not in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'

  /orgs/{orgId}/fixed/denyDonorPortability:
    post:
      tags:
        - Fixed operations
      summary: Deny donor portability
      description: deny donor portability
      operationId: denyDonorPortability
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/denyDonorPortabilityRequest'
      responses:
        '200':
          description: Deny ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilityInfo'
        '400':
          description: Invalid body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
        '404':
          description: Portability not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
        '405':
          description: Portability is not in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'

  /orgs/{orgId}/fixed/patchPortability:
    patch:
      tags:
        - Fixed operations
      summary: Patch portability by processId
      description: Patch portability by processId but does not generate any events
      operationId: patchPortabilityByProcessId
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/portabilityInfo'
      responses:
        '200':
          description: Patch ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilityInfo'
        '400':
          description: Invalid body
          content: {}
        '404':
          description: Portability not found
          content: {}

  /orgs/{orgId}/fixed/accessType:
    post:
      tags:
        - Fixed operations
      summary: Update accessType on a portability
      description: Update accessType on a portability
      operationId: postAccessType
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/accessTypeObject'
      responses:
        '200':
          description: Patch ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilityInfo'
        '400':
          description: Invalid body
          content: {}
        '404':
          description: Portability not found
          content: {}

  /orgs/{orgId}/fixed/requestChangeNrn:
    post:
      tags:
        - Fixed producers
      summary: Request change the NRN of a ported phonenumber
      description: Request change the NRN of a ported phonenumber
      operationId: requestChangeNrn
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/changeNrnRequest'
      responses:
        '200':
          description: Request change NRN in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/createRequestKafka'
        '400':
          description: Invalid body
          content: { }

  /orgs/{orgId}/fixed/cancelChangeNrn:
    post:
      tags:
        - Fixed producers
      summary: Request cancel a change NRN in progress
      description: Request cancel a change NRN in progress
      operationId: cancelChangeNrn
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/cancelChangeNrn'
      responses:
        '200':
          description: Cancel change NRN in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/createRequestKafka'
        '400':
          description: Invalid body
          content: { }

  /orgs/{orgId}/fixed/forceDownloadPortanetFile:
    post:
      tags:
        - Fixed operations
      summary: Force download Portanet file in async mode
      description: Force download Portanet file in async mode
      operationId: forceDownloadPortanetFile
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/forceDownloadPortanetFileRequest'
      responses:
        '200':
          description: "Download in process"
        '400':
          description: Invalid body
          content: {}
        '404':
          description: Invalid ftpFile, operator code or flow
          content: {}

  /orgs/{orgId}/fixed/forceDownloadStorage:
    post:
      tags:
        - Fixed operations
      summary: Force download file from bucket in async mode
      description: Force download file from bucket in async mode
      operationId: forceDownloadStorage
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/forceDownloadStorage'
      responses:
        '200':
          description: "Download in process"
        '400':
          description: Invalid body
          content: { }
        '404':
          description: Invalid ftpFile, operator code or flow
          content: { }

  /orgs/{orgId}/fixed/requestPortability:
    post:
      tags:
        - Fixed producers
      summary: Request a recipient portability
      description: Request a recipient portability
      operationId: requestPortability
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/portabilityRequest'
      responses:
        '200':
          description: Request portability in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/createRequestKafka'
        '400':
          description: Invalid body
          content: {}

  /orgs/{orgId}/fixed/cancelPortability:
    post:
      tags:
        - Fixed producers
      summary: Cancel a recipient portability in progress
      description: Cancel a recipient portability in progress
      operationId: cancelPortability
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/cancelPortability'
      responses:
        '200':
          description: Cancel change NRN in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/createRequestKafka'
        '400':
          description: Invalid body
          content: {}

  /orgs/{orgId}/fixed/requestUnsubscribe:
    post:
      tags:
        - Fixed producers
      summary: Request an unsubscribe portability
      description: Request an unsubscribe portability
      operationId: requestUnsubscribe
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/unsubscribeRequest'
      responses:
        '200':
          description: Request unsubscribe in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/createRequestKafka'
        '400':
          description: Invalid body
          content: {}

  /orgs/{orgId}/fixed/cancelUnsubscribe:
    post:
      tags:
        - Fixed producers
      summary: Cancel an unsubscribe portability in progress
      description: Cancel an unsubscribe portability in progress
      operationId: cancelUnsubscribe
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/cancelUnsubscribe'
      responses:
        '200':
          description: Cancel unsubscribe in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/createRequestKafka'
        '400':
          description: Invalid body
          content: {}

  /orgs/{orgId}/fixed/sendKafkaEvents/{dateField}/{dateValue}:
    post:
      tags:
        - Fixed producers
      summary: Send the kafka events of the selected portabilities
      description: Send the kafka events of the selected portabilities
      operationId: sendKafkaEvents
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
        - name: dateField
          in: path
          description: "The date field to filter: requestDate, messageDate, windowDate or cancellationDate"
          required: true
          schema:
            type: string
            example: "windowDate"
        - name: dateValue
          in: path
          description: "The value date"
          required: true
          schema:
            type: string
            format: date
            example: "2020-01-01"
        - name: filters
          in: query
          description: "Typical filters: externalReference, recipientRol, messageType, processType, ..."
          required: false
          schema:
            type: string
            example: "donorOperator='00031' AND recipientRol=false AND messageType IN ('DSP1', 'DSP2')"
      responses:
        '200':
          description: Events sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilitiesInfo'
        '400':
          description: Invalid body
          content: {}
        '404':
          description: Events not found
          content: {}
        '405':
          description: Validation exception
          content: {}

  /orgs/{orgId}/fixed/impersonate/recipient/qsp:
    post:
      tags:
        - Fixed impersonate
      summary: Impersonate a QSP event as if it came from the E.R.
      description: Impersonate a E.R. queue event
      operationId: impersonateRecipientQsp
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/qspEvent'
      responses:
        '200':
          description: Event processed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilityInfo'
        '400':
          description: Invalid body
          content: {}
        '405':
          description: Portability is not in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'

  /orgs/{orgId}/fixed/impersonate/recipient/asp:
    post:
      tags:
        - Fixed impersonate
      summary: Impersonate an ASP event as if it came from the E.R.
      description: Impersonate a donor operador accept event
      operationId: impersonateRecipientAsp
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/aspEvent'
      responses:
        '200':
          description: Event processed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilityInfo'
        '400':
          description: Invalid body
          content: {}
        '405':
          description: Portability is not in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'

  /orgs/{orgId}/fixed/impersonate/recipient/dsp1:
    post:
      tags:
        - Fixed impersonate
      summary: Impersonate a DSP1 event as if it came from the E.R.
      description: Impersonate a E.R. deny event
      operationId: impersonateRecipientDsp1
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/dsp1Event'
      responses:
        '200':
          description: Event processed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilityInfo'
        '400':
          description: Invalid body
          content: {}
        '405':
          description: Portability is not in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'

  /orgs/{orgId}/fixed/impersonate/recipient/dsp2:
    post:
      tags:
        - Fixed impersonate
      summary: Impersonate a DSP2 event as if it came from the E.R.
      description: Impersonate a donor operador deny event
      operationId: impersonateRecipientDsp2
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/dsp2Event'
      responses:
        '200':
          description: Event processed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilityInfo'
        '400':
          description: Invalid body
          content: {}
        '405':
          description: Portability is not in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'

  /orgs/{orgId}/fixed/impersonate/recipient/w:
    post:
      tags:
        - Fixed impersonate
      summary: Impersonate a W event as if it came from the E.R.
      description: Impersonate a donor operator no-response event
      operationId: impersonateRecipientW
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/wEvent'
      responses:
        '200':
          description: Event processed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilityInfo'
        '400':
          description: Invalid body
          content: {}
        '405':
          description: Portability is not in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'

  /orgs/{orgId}/fixed/impersonate/recipient/pnc:
    post:
      tags:
        - Fixed impersonate
      summary: Impersonate a PNC event as if it came from the E.R.
      description: Impersonate a final portability event
      operationId: impersonateRecipientPnc
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/pncEvent'
      responses:
        '200':
          description: Event processed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilityInfo'
        '400':
          description: Invalid body
          content: {}
        '405':
          description: Portability is not in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'

  /orgs/{orgId}/fixed/impersonate/recipient/stcc:
    post:
      tags:
        - Fixed impersonate
      summary: Impersonate a STCC event as if it came from the E.R.
      description: Impersonate a success cancellation event
      operationId: impersonateRecipientStcc
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/stccEvent'
      responses:
        '200':
          description: Event processed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilityInfo'
        '400':
          description: Invalid body
          content: {}
        '405':
          description: Portability is not in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'

  /orgs/{orgId}/fixed/impersonate/recipient/dcnc:
    post:
      tags:
        - Fixed impersonate
      summary: Impersonate a DCNC event as if it came from the E.R.
      description: Impersonate an unsuccess cancellation event
      operationId: impersonateRecipientDcnc
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
            example: "masmovil"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/dcncEvent'
      responses:
        '200':
          description: Event processed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/portabilityInfo'
        '400':
          description: Invalid body
          content: {}
        '405':
          description: Portability is not in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'


components:
  schemas:
    portabilityInfo:
      type: object
      required:
        - processId
        - recipientRol
      properties:
        phoneRanges:
          $ref: '#/components/schemas/phoneRanges'
        stateId:
          $ref: '#/components/schemas/stateId'
        messageType:
          $ref: '#/components/schemas/messageType'
        externalReference:
          $ref: '#/components/schemas/externalReference'
        brand:
          $ref: '#/components/schemas/brand'
        recipientRol:
          $ref: '#/components/schemas/recipientRol'
        processId:
          $ref: '#/components/schemas/processId'
        recipientOperator:
          $ref: '#/components/schemas/recipientOperator'
        donorOperator:
          $ref: '#/components/schemas/donorOperator'
        requestDate:
          $ref: '#/components/schemas/requestDate'
        messageDate:
          $ref: '#/components/schemas/messageDate'
        windowDate:
          $ref: '#/components/schemas/windowDate'
        cancellationDate:
          $ref: '#/components/schemas/cancellationDate'
        processType:
          $ref: '#/components/schemas/processType'
        administrative:
          $ref: '#/components/schemas/administrative'
        lluProcessId:
          $ref: '#/components/schemas/lluProcessId'
        fullNumberFlag:
          $ref: '#/components/schemas/fullNumberFlag'
        wholesalerFlag:
          $ref: '#/components/schemas/wholesalerFlag'
        accessType:
          $ref: '#/components/schemas/accessType'
        donorResellerOperator:
          $ref: '#/components/schemas/donorResellerOperator'
        recipientResellerOperator:
          $ref: '#/components/schemas/recipientResellerOperator'
        subscriber:
          $ref: '#/components/schemas/subscriber'
        causeCode:
          $ref: '#/components/schemas/causeCode'
        causeDescription:
          $ref: '#/components/schemas/causeDescription'
        observations:
          $ref: '#/components/schemas/observations'
        infoTariff:
          $ref: '#/components/schemas/infoTariff'
        internal:
          $ref: '#/components/schemas/internal'
        isCancellable:
          $ref: '#/components/schemas/isCancellable'
        accessPhoneRanges:
          $ref: '#/components/schemas/accessPhoneRanges'
        eventList:
          type: array
          items:
            $ref: '#/components/schemas/event'

    portabilitiesInfo:
      type: array
      items:
        $ref: '#/components/schemas/portabilityInfo'

    minimumWindowDate:
      type: object
      required:
        - result
      properties:
        result:
          type: string
          description: minimum window date
          example: "2024-05-20T22:00:00Z"

    accessTypeObject:
      type: object
      required:
        - processId
        - accessType
        - fullNumberFlag
      properties:
        processId:
          $ref: '#/components/schemas/processId'
        fullNumberFlag:
          $ref: '#/components/schemas/fullNumberFlag'
        accessType:
          $ref: '#/components/schemas/accessType'
        infoTariff:
          $ref: '#/components/schemas/infoTariff'

    acceptDonorPortabilityRequest:
      type: object
      required:
        - processId
      properties:
        processId:
          $ref: '#/components/schemas/processIdMandatory'
        phoneRanges:
          $ref: '#/components/schemas/phoneRanges'
        observations:
          $ref: '#/components/schemas/observations'
        externalReference:
          $ref: '#/components/schemas/externalReference'

    denyDonorPortabilityRequest:
      type: object
      required:
        - processId
        - causeCode
      properties:
        processId:
          $ref: '#/components/schemas/processIdMandatory'
        causeCode:
          $ref: '#/components/schemas/causeCodeMandatory'
        causeDescription:
          $ref: '#/components/schemas/causeDescription'
        administrative:
          $ref: '#/components/schemas/administrative'
        accessPhoneRanges:
          $ref: '#/components/schemas/accessPhoneRanges'
        observations:
          $ref: '#/components/schemas/observations'
        externalReference:
          $ref: '#/components/schemas/externalReference'

    errorResponse:
      type: object
      properties:
        code:
          type: string
          description: error code
          example: "0002"
        status:
          type: string
          description: status code response
          example:  "BAD_REQUEST"
        message:
          type: string
          description: message response
          example: "Bad Request"
        detailMsg:
          type: string
          description: detail description of error
          example:  "Portability not found"

    changeNrnRequest:
      type: object
      required:
        - recipientOperator
        - initialRange
        - endRange
      properties:
        externalReference:
          $ref: '#/components/schemas/externalReference'
        internal:
          $ref: '#/components/schemas/internal'
        recipientOperator:
          $ref: '#/components/schemas/recipientOperatorMandatory'
        donorOperator:
          $ref: '#/components/schemas/donorOperator'
        observations:
          $ref: '#/components/schemas/observations'
        windowDate:
          $ref: '#/components/schemas/windowDate'
        initialRange:
          $ref: '#/components/schemas/initialRange'
        endRange:
          $ref: '#/components/schemas/endRange'
        nrnRange:
          $ref: '#/components/schemas/nrnRange'

    cancelChangeNrn:
      type: object
      required:
        - causeCode
      properties:
        processId:
          $ref: '#/components/schemas/processId'
        externalReference:
          $ref: '#/components/schemas/externalReference'
        recipientOperator:
          $ref: '#/components/schemas/recipientOperator'
        internal:
          $ref: '#/components/schemas/internal'
        donorOperator:
          $ref: '#/components/schemas/donorOperator'
        causeCode:
          $ref: '#/components/schemas/causeCodeMandatory'
        observations:
          $ref: '#/components/schemas/observations'

    cause:
      type: object
      required:
        - messageType
        - causeCode
      properties:
        messageType:
          $ref: '#/components/schemas/messageTypeMandatory'
        causeCode:
          $ref: '#/components/schemas/causeCodeMandatory'
        causeDescription:
          $ref: '#/components/schemas/causeDescription'

    causes:
      type: array
      items:
        $ref: '#/components/schemas/cause'

    holiday:
      type: object
      required:
        - isHoliday
      properties:
        isHoliday:
          type: boolean
          description: "return is holiday"
          example: true
    date:
      type: string
      format: date
      description: date
      example: "2024-12-25"

    holidayCalendar:
      type: array
      items:
        $ref: '#/components/schemas/date'

    forceDownloadPortanetFileRequest:
      type: object
      required:
        - ftpFile
        - operatorId
        - date
      properties:
        ftpFile:
          type: string
          description: Ftp file name
          example: "dsp2_15_r"
        operatorId:
          type: string
          pattern: '^\d{5}$'
          description: operator code
          example: "00031"
        date:
          type: string
          format: date
          description: file date
          example: "2017-09-15"

    forceDownloadStorage:
      type: object
      required:
        - ftpFile
        - operatorId
        - date
      properties:
        ftpFile:
          type: string
          description: Ftp file name
          example: "SP_D"
        operatorId:
          type: string
          pattern: '^\d{5}$'
          description: operator code
          example: "00031"
        date:
          type: string
          format: date
          description: file date
          example: "2017-09-15"

    portabilityRequest:
      type: object
      required:
        - externalReference
        - phoneRanges
        - recipientOperator
        - processType
        - subscriber
      properties:
        phoneRanges:
          $ref: '#/components/schemas/phoneRanges'
        externalReference:
          $ref: '#/components/schemas/externalReference'
        recipientOperator:
          $ref: '#/components/schemas/recipientOperatorMandatory'
        windowDate:
          $ref: '#/components/schemas/windowDate'
        administrative:
          $ref: '#/components/schemas/administrative'
        lluProcessId:
          $ref: '#/components/schemas/lluProcessId'
        fullNumberFlag:
          $ref: '#/components/schemas/fullNumberFlag'
        wholesalerFlag:
          $ref: '#/components/schemas/wholesalerFlag'
        coordinatedActionFlag:
          $ref: '#/components/schemas/coordinatedActionFlag'
        accessType:
          $ref: '#/components/schemas/accessType'
        recipientResellerOperator:
          $ref: '#/components/schemas/recipientResellerOperator'
        processType:
          $ref: '#/components/schemas/processType'
        subscriber:
          $ref: '#/components/schemas/subscriber'
        infoTariff:
          $ref: '#/components/schemas/infoTariff'
        observations:
          $ref: '#/components/schemas/observations'

    createRequestKafka:
      type: object
      properties:
        topic:
          type: string
          description: topic
          example: "topic"
        partition:
          type: integer
          description: partition
          example: 0
        offset:
          type: integer
          description: offset

    cancelPortability:
      type: object
      required:
        - processId
        - causeCode
      properties:
        processId:
          $ref: '#/components/schemas/processIdMandatory'
        causeCode:
          $ref: '#/components/schemas/causeCodeMandatory'
        observations:
          $ref: '#/components/schemas/observations'

    unsubscribeRequest:
      type: object
      required:
        - recipientOperator
        - donorOperator
        - initialRange
        - endRange
      properties:
        recipientOperator:
          $ref: '#/components/schemas/recipientOperatorMandatory'
        donorOperator:
          $ref: '#/components/schemas/donorOperatorMandatory'
        initialRange:
          $ref: '#/components/schemas/initialRange'
        endRange:
          $ref: '#/components/schemas/endRange'
        observations:
          $ref: '#/components/schemas/observations'

    cancelUnsubscribe:
      type: object
      required:
        - processId
        - causeCode
      properties:
        processId:
          $ref: '#/components/schemas/processIdMandatory'
        causeCode:
          $ref: '#/components/schemas/causeCodeMandatory'
        observations:
          $ref: '#/components/schemas/observations'

    qspEvent:
      type: object
      required:
        - processId
      properties:
        processId:
          $ref: '#/components/schemas/processIdMandatory'
        windowDate:
          $ref: '#/components/schemas/windowDate'

    aspEvent:
      type: object
      required:
        - processId
      properties:
        processId:
          $ref: '#/components/schemas/processIdMandatory'
        phoneRanges:
          $ref: '#/components/schemas/phoneRanges'
        windowDate:
          $ref: '#/components/schemas/windowDate'
        observations:
          $ref: '#/components/schemas/observations'

    dsp1Event:
      type: object
      required:
        - processId
        - causeCode
      properties:
        processId:
          $ref: '#/components/schemas/processIdMandatory'
        causeCode:
          $ref: '#/components/schemas/causeCodeMandatory'
        observations:
          $ref: '#/components/schemas/observations'

    dsp2Event:
      type: object
      required:
        - processId
        - causeCode
      properties:
        processId:
          $ref: '#/components/schemas/processIdMandatory'
        causeCode:
          $ref: '#/components/schemas/causeCodeMandatory'
        administrative:
          $ref: '#/components/schemas/administrative'
        phoneRanges:
          $ref: '#/components/schemas/phoneRanges'
        observations:
          $ref: '#/components/schemas/observations'

    wEvent:
      type: object
      required:
        - processId
        - causeCode
      properties:
        processId:
          $ref: '#/components/schemas/processIdMandatory'
        causeCode:
          $ref: '#/components/schemas/causeCodeMandatory'
        observations:
          $ref: '#/components/schemas/observations'

    pncEvent:
      type: object
      required:
        - processId
      properties:
        processId:
          $ref: '#/components/schemas/processIdMandatory'

    stccEvent:
      type: object
      required:
        - processId
      properties:
        processId:
          $ref: '#/components/schemas/processIdMandatory'

    dcncEvent:
      type: object
      required:
        - processId
        - causeCode
      properties:
        processId:
          $ref: '#/components/schemas/processIdMandatory'
        causeCode:
          $ref: '#/components/schemas/causeCodeMandatory'
        observations:
          $ref: '#/components/schemas/observations'

    acquisitionStatus:
      type: object
      properties:
        id:
          type: string
          description: status id
          example: "1"
        description:
          type: string
          description: status description
          example: "Portado"
        cancellable:
          type: boolean
          description: is cancellable the current status
          example: false

    acquisitionDate:
      type: object
      properties:
        operator:
          type: string
          pattern: '^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\.\d+)?$'
          description: operators last modified date
          example: "2017-09-15T08:00:00"
        cmt_numeration:
          type: string
          pattern: '^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\.\d+)?$'
          description: cmt_numeration last modified date
          example: "2017-09-15T08:00:00"
        acquisition:
          type: string
          pattern: '^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\.\d+)?$'
          description: acquisition last modified date
          example: "2017-09-15T08:00:00"
    operator:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: string
          description: operator code
          example: "00031"
        name:
          type: string
          description: operator name
          example: "Xtra Telecom S.A."
        license:
          type: string
          nullable: true
          description: license type
          example: "01"
        community:
          type: string
          description: community type
          example: "15"

    ownerOperator:
      type: object
      properties:
        phonenumber:
          type: string
          description: phonenumber
          example: "911111111"
        donorOperator:
          type: string
          description: donor operator code
          example: "00001"
        donorOperatorName:
          type: string
          description: donor operator name
          example: "Movistar"
        recipientOperator:
          type: string
          description: recipient operator code
          example: "00031"
        recipientOperatorName:
          type: string
          description: recipient operator name
          example: "Xtra"
        initialDonorOperator:
          type: string
          description: initial donor operator code
          example: "00002"
        initialDonorOperatorName:
          type: string
          description: initial donor operator name
          example: "Vodafone"
        initialDonorOperator2:
          type: string
          description: initial donor operator 2 code
          example: "00002"
        initialDonorOperator2Name:
          type: string
          description: initial donor operator 2 name
          example: "Vodafone"
        initialDonorOperator3:
          type: string
          description: initial donor operator 3 code
          example: "00002"
        initialDonorOperator3Name:
          type: string
          description: initial donor operator 3 name
          example: "Vodafone"
        nrn:
          type: string
          description: network routing number
          example: "312800"
        windowDate:
          type: string
          pattern: '^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\.\d+)?$'
          description: portability date
          example: "2017-09-15T08:00:00"
        status:
          type: string
          description: status code
          example: "1"
        statusName:
          type: string
          description: status name
          example: "Portado"
        recipientResellerOperator:
          type: string
          description: recipient reseller operator name
          example: "XFERA"
        donorResellerOperator:
          type: string
          description: donor reseller operator name
          example: "CABLEMOBIL"

    externalReference:
      type: string
      nullable: true
      description: externalReference associated
      example: "MYSIM_112233"

    brand:
      type: string
      nullable: true
      description: brand associated
      example: "MASMOVIL"

    stateId:
      type: integer
      format: int32
      description: portability state
      example: 1

    processId:
      type: string
      nullable: true
      pattern: '^\d{20}$'
      description: process id in Portanet
      example: "00031202005111500003"

    processIdMandatory:
      type: string
      nullable: false
      pattern: '^\d{20}$'
      description: process id in Portanet
      example: "00031202005111500003"

    processType:
      type: integer
      format: int32
      description: process type
      example: 15

    messageType:
      type: string
      nullable: true
      pattern: '^.{1,5}$'
      description: Message type Portabaility
      example: "DSP1"

    messageTypeMandatory:
      type: string
      nullable: false
      pattern: '^.{1,5}$'
      description: Message type Portabaility
      example: "DSP1"

    recipientRol:
      type: boolean
      description: operator rol recipient or donor
      example: true

    recipientOperator:
      type: string
      nullable: true
      pattern: '^\d{5}$'
      description: current recipient operator code
      example: "00031"

    recipientOperatorMandatory:
      type: string
      nullable: false
      pattern: '^\d{5}$'
      description: current recipient operator code
      example: "00031"

    donorOperator:
      type: string
      nullable: true
      pattern: '^\d{5}$'
      description: initial donor operator code
      example: "00001"

    donorOperatorMandatory:
      type: string
      nullable: false
      pattern: '^\d{5}$'
      description: initial donor operator code
      example: "00001"

    infoTariff:
      type: string
      nullable: true
      pattern: '^.{0,80}$'
      description: info tariff of a portability
      example: ""

    subscriber:
      type: object
      properties:
        nif:
          type: string
          description: subscriber nif
          example: "11111111H"
        name:
          type: string
          description: subscriber full name
          example: "nombre apellidos"
        address:
          type: string
          description: subscriber address
          example: "Calle COLON"
        postalCode:
          type: string
          description: subscriber postalcode
          example: "28100"
        province:
          type: string
          description: subscriber province code
          example: "28"
        town:
          type: string
          description: subscriber town
          example: "Madrid"
        date:
          type: string
          nullable: true
          pattern: '^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\.\d+)?$'
          description: subscriber request date
          example: "2017-09-13T13:00:00"

    windowDate:
      type: string
      nullable: true
      pattern: '^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\.\d+)?$'
      description: portability window
      example: "2017-09-15T08:00:00"

    windowDateMandatory:
      type: string
      nullable: false
      pattern: '^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\.\d+)?$'
      description: portability window
      example: "2017-09-15T08:00:00"

    requestDate:
      type: string
      nullable: true
      pattern: '^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\.\d+)?$'
      description: request date for portability
      example: "2017-09-13T13:00:00"

    messageDate:
      type: string
      nullable: true
      pattern: '^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\.\d+)?$'
      description: date to send to Portanet
      example: "2017-09-13T14:00:00"

    cancellationDate:
      type: string
      nullable: true
      pattern: '^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\.\d+)?$'
      description: cancellation date
      example: "2017-09-15T08:00:00"

    administrative:
      type: string
      nullable: true
      pattern: '^\d{0,14}$'
      description: administrative access number
      example: "445022444216"

    lluProcessId:
      type: string
      nullable: true
      pattern: '^\d{0,21}$'
      description: local loop unbundling identifier
      example: "550739346020000001"

    fullNumberFlag:
      type: integer
      format: int32
      description: full number flag
      example: 0

    coordinatedActionFlag:
      type: integer
      format: int32
      description: coordinated action flag
      example: 0

    wholesalerFlag:
      type: integer
      format: int32
      description: wholesaler flag
      example: 0

    accessType:
      type: string
      nullable: true
      description: portability access type
      pattern: '^\d{2}$'
      example: "01"

    donorResellerOperator:
      type: string
      nullable: true
      pattern: '^.{0,80}$'
      description: donor reseller operator
      example: "REVENDEDOR"

    recipientResellerOperator:
      type: string
      nullable: true
      pattern: '^.{0,80}$'
      description: recipient reseller operator
      example: "MASMOVIL"

    causeCode:
      type: string
      nullable: true
      pattern: '^\d{4}$'
      description: cause code of a denied operation
      example: "0001"

    causeCodeMandatory:
      type: string
      nullable: false
      pattern: '^\d{4}$'
      description: cause code of a denied operation
      example: "0001"

    causeDescription:
      type: string
      nullable: true
      pattern: '^.{0,80}$'
      description: cause description of a denied operation
      example: "Falta de correspondencia entre numeración y NIF/CIF del abonado del revendedor"

    observations:
      type: string
      nullable: true
      description: observations of a portability
      pattern: '^.{0,80}$'
      example: ""

    internal:
      type: boolean
      description: is a portability between own operators
      example: false

    isCancellable:
      type: boolean
      description: is a portability cancellable
      example: false

    nrnRange:
      type: string
      nullable: false
      pattern: '^\d{6}$'
      description: nrn range
      example: "312800"

    initialRange:
      type: string
      nullable: false
      pattern: '^[89]\d{8}$'
      description: intial phone number range
      example: "900000000"

    endRange:
      type: string
      nullable: false
      pattern: '^[89]\d{8}$'
      description: end phone number range
      example: "900000000"

    phoneRange:
      type: object
      required:
        - nrnRange
        - initialRange
        - endRange
      properties:
        nrnRange:
          $ref: '#/components/schemas/nrnRange'
        initialRange:
          $ref: '#/components/schemas/initialRange'
        endRange:
          $ref: '#/components/schemas/endRange'

    phoneRanges:
      type: array
      nullable: true
      items:
        $ref: '#/components/schemas/phoneRange'

    accessPhoneRange:
      type: object
      required:
        - accessType
        - initialRange
        - endRange
      properties:
        accessType:
          $ref: '#/components/schemas/accessType'
        initialRange:
          $ref: '#/components/schemas/initialRange'
        endRange:
          $ref: '#/components/schemas/endRange'

    accessPhoneRanges:
      type: array
      nullable: true
      items:
        $ref: '#/components/schemas/accessPhoneRange'

    eventTimestamp:
      type: string
      pattern: '^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\.\d+)?$'
      description: event datetime
      example: "2017-09-15T08:42:33.123456"

    messageId:
      type: string
      nullable: true
      pattern: '^\d{20}$'
      description: message id in Portanet
      example: "00031202005110000003"

    subProcessId:
      type: string
      nullable: true
      pattern: '^\d{20}$'
      description: subprocess id in Portanet
      example: "00031202005110200003"

    eventType:
      type: string
      description: event type
      example: "EVENT"

    event:
      type: object
      required:
        - eventTimestamp
        - messageType
        - eventType
      properties:
        eventTimestamp:
          $ref: '#/components/schemas/eventTimestamp'
        messageType:
          $ref: '#/components/schemas/messageType'
        messageId:
          $ref: '#/components/schemas/messageId'
        subProcessId:
          $ref: '#/components/schemas/subProcessId'
        eventType:
          $ref: '#/components/schemas/eventType'
        causeCode:
          $ref: '#/components/schemas/causeCode'
        administrative:
          $ref: '#/components/schemas/administrative'
