openapi: 3.0.3
info:
  title: MasCustomers API
  description: >
    I am <b><i>MasCustomers API</i></b>. My intention is provide the necessary functionality to be able to give E2E coverage to the entire life-cycle of a client.
    <br><br>
    <b>NOTE:</b> The examples provided here are made up and should not be used for testing purposes. Make sure to change all parameters before attempting to make any request.
  version: 2.38.2
externalDocs:
  description: Find out more about Swagger
  url: https://developer-portal-master.private.dev-01.k8s.masmovil.com/en/docs/
servers:
  # Public Servers
  - url: https://customers.sta.masstack.com/v2/
    description: staging
  - url: https://customers.masstack.com/v2/
    description: production
tags:
  - name: Signups
    description: Access to signups new clients
  - name: Users
    description: Access to user
  - name: Accounts
    description: Access to accounts
  - name: Invoices
    description: Access to invoices
  - name: Terms
    description: Access to terms
  - name: Payment info
    description: Access to payment info
  - name: Account migrations
    description: Access to Product migrations
  - name: Subscriptions
    description: Access to subscriptions
  - name: Products
    description: Access to products
  - name: Services
    description: Access to services
  - name: Bonuses
    description: Access to bonuses (Free Unit Packages)
  - name: Promotions
    description: Access to promotions
  - name: Barrings
    description: Proxy to selfCareSocket blocks
  - name: Workorders
    description: Proxy to MySimWS
  - name: Penalties
    description: Proxy to penalties

paths:
  /orgs/{orgId}/accounts/{accountId}:
    get:
      tags:
        - Accounts
      summary: Get account information
      description: Returns all the info about a single account given by accountId.
      operationId: getAccount
      security:
        - permissions:
            - customers.accounts.read
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/accountId'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountInfo'
        '400':
          description: Invalid account ID supplied
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: Account not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

  /orgs/{orgId}/accounts/{accountId}/tax:
    get:
      tags:
        - Accounts
      summary: Get tax value
      description: Return tax value by accountId
      operationId: getTaxForAccount
      security:
        - permissions:
            - customers.accounts.taxes.list
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/accountId'
        - $ref: '#/components/parameters/includeHistoricalChanges'
        - $ref: '#/components/parameters/historicalChangesStartDate'
        - $ref: '#/components/parameters/historicalChangesEndDate'
      responses:
        '200':
          description: array of compatible bundles
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaxAccountInfo'
        '400':
          description: Invalid account ID supplied
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: Compatible account bundles not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

  /orgs/{orgId}/accounts/{accountId}/contracts:
    get:
      tags:
        - Accounts
      summary: Get Account Contracts
      description: Get account contracts
      operationId: getAccountContracts
      security:
        - permissions:
            - customers.accounts.contracts.list
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/accountId'
        - name: signature_config
          in: query
          required: true
          description: "Signature config"
          schema:
            type: string
            enum:
              - CONVERGENTE
              - SOLOMOVIL
              - TV
              - TERMINAL
              - SIM_REPLACEMENT
              - CHANGE_ADDRESS
              - BUNDLE_MIGRATION
              - CHANGE_TECHNOLOGY
              - UNFINANCED_TERMINAL
              - FINANCED_TERMINAL
              - BUNDLE_ADDLINE
              - CHANGE_OWNER
        - name: account_bundle_id
          in: query
          required: false
          schema:
            type: number
            format: int64
        - name: subscription_id
          in: query
          required: false
          schema:
            type: number
            format: int64
        - name: subscription_terminal_id
          in: query
          schema:
            type: number
            format: int64
        - name: iccid
          in: query
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAccountContractsResponse'
        '404':
          description: Computed penalty id not found
          $ref: '#/components/responses/404NotFoundGeneric'

  /orgs/{orgId}/accounts/{accountId}/paymentinfo:
    get:
      tags:
        - Payment info
      summary: Get payment info
      description: >
        Returns payment info (bank account) given by accountId.
        <h1>This endpoint will be deprecated on **January 1, 2026**.</h1>
        <h2>Please use [new endpoint](https://developers.masstack.com/en/docs/apis_customers_doc_swagger/4/schemas/#schemagetaccount) instead.</h2>
      operationId: getAccountPaymentInfo
      deprecated: true
      security:
        - permissions:
            - customers.accounts.paymentmethod.read
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/accountId'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentInfo'
        '400':
          description: Invalid account ID supplied
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: Account not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

  /orgs/{orgId}/accounts/{accountId}/promotions:
    get:
      tags:
        - Promotions
      summary: Get promotions
      description: Returns an array of promotions grouped in three levels (subscription, account, account bundle). Default response includes active and scheduled promotions
      operationId: getAccountPromotions
      security:
        - permissions:
            - customers.accounts.promotions.list
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/accountId'
        - name: query
          in: query
          description: Filter array can be used to show 'inactive' promotions instead of the active ones.
          required: false
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Query'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Promotions'
        '400':
          description: Invalid account id supplied
          $ref: '#/components/responses/400BadRequestGeneric'

  /orgs/{orgId}/accounts/{accountId}/terms:
    get:
      tags:
        - Terms
      summary: Get Account terms
      description: Returns terms info  given by accountId. Items are ordered with end date descending order.
      operationId: getAccountTerms
      security:
        - permissions:
            - customers.accounts.terms.list
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/accountId'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AccountTerms'
        '400':
          description: Invalid account id supplied
          $ref: '#/components/responses/400BadRequestGeneric'

  /orgs/{orgId}/accounts/{accountId}/invoices:
    get:
      tags:
        - Invoices
      summary: Get invoices list
      description: Returns invoices info related to a given accountId
      operationId: getInvoicesListAccount
      security:
        - permissions:
            - customers.accounts.invoices.list
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/accountId'
        - $ref: '#/components/parameters/startDate'
        - $ref: '#/components/parameters/endDate'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceInfoList'
        '400':
          description: Invalid account ID supplied
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: Account invoice not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

  /orgs/{orgId}/subscriptions/{subscriptionId}:
    get:
      tags:
        - Subscriptions
      summary: Get subscription info
      description: Returns subscription info given by subscriptionId
      operationId: getSubscription
      deprecated: true
      security:
        - permissions:
            - customers.subscriptions.read
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/subscriptionId'
        - name: query
          in: query
          description: Use 'include' to get
            <ul>
            <li>'origin' -> origin of the subscription (new, from portability, from migration, etc.)</li>
            <li>'selldate' -> date of last change of status</li>
            <li>'historical_status' -> all status changes over time, including the current one, sorted by time</li>
            </ul>
          required: false
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Query'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
        '400':
          description: Invalid subscription ID supplied
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: subscription not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

  /orgs/{orgId}/subscriptions/{subscriptionId}/devices:
    get:
      deprecated: true
      tags:
        - Subscriptions
      summary: Get devices info
      description: Returns devices subscription info given by subscriptionId
      operationId: getSubscriptionDevices
      security:
        - permissions:
            - customers.subscriptions.devices.list
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/subscriptionId'
      responses:
        '200':
          description: returns list of terminals of a subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionDevices'
        '400':
          description: Invalid subscription ID supplied
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: subscription not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'
    post:
      tags:
        - Subscriptions
      summary: Add device to subscription
      description: Add device to subscription
      operationId: postSubscriptionDevice
      security:
        - permissions:
            - customers.subscriptions.devices.create
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/subscriptionId'
        - $ref: '#/components/parameters/ipAddress'
      requestBody:
        description: Add device to subscription
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddDeviceToSubscriptionRequest'
      responses:
        '201':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddDeviceToSubscriptionResponse'
        '202':
          description: check risk decision
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddDeviceToSubscriptionResponse'
        '400':
          description: Invalid subscription id or invalid device
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: subscription or device not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

  /orgs/{orgId}/subscriptions/{subscriptionId}/products:
    get:
      tags:
        - Products
      summary: Get info products
      description: Returns current product including last change(s) and compatibilities for a given subscriptionId
      operationId: getProductSubscription
      security:
        - permissions:
            - customers.subscriptions.products.read
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/subscriptionId'
        - name: query
          in: query
          required: false
          description: Use 'include' to get
            <ul>
            <li>compatibilities -> Get compatible tariffs</li>
            <li>historical_changes -> Get history of tariff changes</li>
            </ul>
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Query'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionProduct'
        '400':
          description: Invalid subscription ID supplied
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: subscription not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

    patch:
      tags:
        - Products
      summary: Update subscription product
      description: Change subscription products given by new productId & subscriptionId. Bundled main line products can not be changed this way.
      operationId: patchSubscriptionProduct
      security:
        - permissions:
            - customers.subscriptions.products.update
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/subscriptionId'
      requestBody:
        description: Change subscription product given a productId
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChangeSubscriptionProductRequest'
      responses:
        '201':
          description: successful operation
          content: { }
        '202':
          description: check risk decision
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChangeSubscriptionProductResponse'
        '400':
          description: Invalid subscription or product id
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: pair subscription - product not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

  /orgs/{orgId}/subscriptions/{subscriptionId}/bonuses:
    get:
      tags:
        - Bonuses
      summary: Get bonus info
      description: Returns bonuses which are associated with a subscription identificator given by subscriptionId. Default response includes active and scheduled bonuses
      operationId: getBonusSubscription
      security:
        - permissions:
            - customers.subscriptions.bonuses.list
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/subscriptionId'
        - name: query
          in: query
          description: Filter array can be used to show 'active' (without scheduled), 'actual' or 'inactive' bonuses.
          required: false
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Query'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionBonus'
        '400':
          description: Invalid subscription ID supplied
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: subscription not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

    put:
      tags:
        - Bonuses
      summary: Add new bonus
      description: Given a subscriptionId, this method allows to add a bonus to the subscription (bonusId must to be informed as parameter)
      operationId: putBonusesSubscription
      security:
        - permissions:
            - customers.subscriptions.bonuses.update
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/subscriptionId'
      requestBody:
        description: Add bonus to a subscriptionId (must include bonusId to add)
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionBonusesRequest'
      responses:
        '201':
          description: successful operation
          content: { }
        '400':
          description: Invalid subscription or bonus id
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: bonus not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

  /orgs/{orgId}/subscriptions/{subscriptionId}/bonuses/{bonusId}:
    delete:
      tags:
        - Bonuses
      summary: Delete bonus
      description: Given a subscriptionId, this method allow to delete a bonus to the subscription (bonusId must to be informed as parameter)
      operationId: deleteBonusesSubscription
      security:
        - permissions:
            - customers.subscriptions.bonuses.delete
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/subscriptionId'
        - $ref: '#/components/parameters/bonusId'
        - name: scheduled_date
          in: query
          example: '2020-01-01'
          description: Desired date to execute operation
          required: false
          schema:
            type: string
            format: date
      responses:
        '202':
          description: successful operation
          content: { }
        '400':
          description: Invalid subscription or bonus id
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: pair bonus not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

  /orgs/{orgId}/subscriptions/{subscriptionId}/services:
    get:
      deprecated: true
      tags:
        - Services
      summary: Get info services
      description: >
        Returns an array of items with all the services associated to the subscriptionId given.
        <h2>Please use [new endpoint](https://developers.masstack.com/en/docs/apis_barrings_doc_swagger/3/services/#op-getSubscriptionServices) instead.</h2>
      operationId: getServicesSubscription
      security:
        - permissions:
            - customers.subscriptions.services.list
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/subscriptionId'
        - name: query
          in: query
          required: false
          description: User 'filter' to get 'active' or 'inactive' services
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Query'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionServices'
        '400':
          description: Invalid subscription ID supplied
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: subscription not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

  /orgs/{orgId}/subscriptions/{subscriptionId}/services/{serviceId}:
    patch:
      deprecated: true
      tags:
        - Services
      summary: Update a service status
      description: >
        Change values of Active to 'True/False' given by serviceId & subscriptionId.<br>
                <ul>
                <li>8 - (BLOQUEO DE LLAMADAS ENTRANTES)</li>
                <li>9 - (BLOQUEO DE LLAMADAS SALIENTES)</li>
                <li>10 - (ENVIO SM)</li>
                <li>11 - (3G (GPRS)</li>
                <li>12 - (ROAMING)</li>
                <li>13 - (RECIBIR SMS)</li>
                <li>15 - (BLOQUEO LLAMADAS INTERNACIONALES)</li>
                <li>22 - (BLOQUEO NÚMEROS TARIFICACIÓN ESPECIAL)</li>
                <li>27 - (SERVICIOS PREMIUM)</li>
                <li>31 - (Robo-perdida)</li>
                <li>32 - (Suspension Temporal)</li>
                <li>37 - (5G)</li>
                <li>42 - (SERVICIOS PREMIUM INFORMACION)</li>
                <li>43 - (SERVICIOS PREMIUM ENTRETENIMIENTO)</li>
                </ul>
        <h2>Please use [new endpoint](https://developers.masstack.com/en/docs/apis_barrings_doc_swagger/3/services/#op-operateServices) instead.</h2>
      operationId: patchSubscriptionService
      security:
        - permissions:
            - customers.subscriptions.services.update
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/subscriptionId'
        - $ref: '#/components/parameters/serviceId'
      requestBody:
        description: Change service status
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceStatus'
      responses:
        '201':
          description: successful operation
          content: { }
        '400':
          description: Invalid subscription or service id
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: pair subscription - service not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

  /orgs/{orgId}/subscriptions/{subscriptionId}/blocks:
    get:
      deprecated: true
      tags:
        - Barrings
      summary: Get blocks info
      description: >
        Returns the subscription's blocking reason for a subscriptionId given, filtered results by theft or loss.
        <h2>Please use [new endpoint](https://developers.masstack.com/en/docs/apis_barrings_doc_swagger/3/masks/#op-getSubscriptionMasks) instead.</h2>
      operationId: getSubscriptionBlocks
      security:
        - permissions:
            - customers.subscriptions.blocks.list
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/subscriptionId'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionBlocks'
        '400':
          description: Invalid subscription ID supplied
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: subscription not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

  /orgs/{orgId}/subscriptions/{subscriptionId}/blocks/{blockId}:
    patch:
      deprecated: true
      tags:
        - Barrings
      summary: Update SIM Status to Blocked or Unblocked
      description: Change to Block / Unblock SIM_CARD with origin theft or loss  related to a given subscriptionId.
      operationId: patchBlock
      security:
        - permissions:
            - customers.subscriptions.blocks.update
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/subscriptionId'
        - $ref: '#/components/parameters/blockId'
      requestBody:
        description: Change block status
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BlockStatus'
      responses:
        '201':
          description: successful operation
          content: { }
        '400':
          description: Invalid subscription or service id
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: pair subscription - service not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

  /orgs/{orgId}/subscriptions/{subscriptionId}/sim-replacement:
    patch:
      tags:
        - Subscriptions
      summary: Replace SIM
      description: Replace sim icc to a new one
      operationId: patchSimcardReplacement
      security:
        - permissions:
            - customers.subscriptions.sim.update
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/subscriptionId'
        - $ref: '#/components/parameters/ipAddress'
      requestBody:
        description: Contains dealer id, shop id (if present), offline/online value and new icc
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SimReplacement'
      responses:
        '201':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimReplacementResponse'
        '202':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimReplacementResponse'
        '400':
          description: Invalid subscription or service id
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: pair subscription - service not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

  /orgs/{orgId}/signups/migration:
    post:
      tags:
        - Account migrations
      summary: Bundle migration
      description: Migrate bundle account to another bundle. When using only required fields (account_id and new_bundle_id) in request, existing additional and extra mobiles lines must be sent too with their subscription_id and destination product_id.
      operationId: postBundleMigration
      security:
        - permissions:
            - customers.signups.migration.create
      parameters:
        - $ref: '#/components/parameters/orgId'
      # TODO: refactor this
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BundleMigrationRequest'
            examples:
              CompleteRequest:
                value:
                  - sales_info:
                    value:
                      - dealer_id: "C00002"
                        shop_id: "0025"
                        logistic: false
                    account:
                      value:
                        - account_id: 5827148
                          new_bundle_id: 954
                          subscriptions:
                            value:
                              - ftth:
                                  value:
                                    - product_id: 3036
                                mobile_lines:
                                  values:
                                    - subscription_id: 8619281
                                      type: "main"
                                      product_id: 364
                                      msisdn: "693533593"
              MinimumRequest:
                value:
                  - account:
                      value:
                        - account_id: 5827148
                          new_bundle_id: 954


      responses:
        '200':
          description: Bundle migration ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BundleMigrationResponse'
        '202':
          description: Check risk decision
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BundleMigrationResponse'
        '400':
          $ref: '#/components/responses/400BadRequestGeneric'

  /orgs/{orgId}/subscriptions/{subscriptionId}/recharge/detail:
    get:
      tags:
        - Subscriptions
      summary: Get recharge details
      description: Get recharge details between two dates or actual month. if it doesn't include dates, it will take the current month by subscriptionId given.
      operationId: getRechargeDetailSubscription
      security:
        - permissions:
            - customers.subscriptions.recharges.list
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/subscriptionId'
        - $ref: '#/components/parameters/startDate'
        - $ref: '#/components/parameters/endDate'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionDetailRecharge'
        '400':
          description: Invalid subscription ID supplied
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: subscription not found or related msisdn isn't prepaid
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

  /orgs/{orgId}/users/tree:
    post:
      tags:
        - Users
      summary: Get customer tree associated to a given document identification, email or number
      description: Returns customer tree data
      operationId: searchUsers
      security:
        - permissions:
            - customers.users.tree.read
      parameters:
        - $ref: '#/components/parameters/orgId'
      requestBody:
        description: User search parameters
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserTreeSearch'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Users-user'
        '400':
          description: Email/msisdn/nif parameter required
          $ref: '#/components/responses/400BadRequestGeneric'
        '403':
          $ref: '#/components/responses/403ForbiddenGeneric'

    get:
      tags:
        - Users
      summary: Get customer tree by client info
      description: >
        Returns customer tree data  associated to a given document identification, email or number of the client.
        <h1>This endpoint will be deprecated on **January 1, 2026**.</h1>
        <h2>Please use [new endpoint](https://developers.masstack.com/en/docs/apis_customers_doc_swagger/2/users/#op-searchUsers) instead.</h2>
      operationId: users
      deprecated: true
      security:
        - permissions:
            - customers.users.tree.deprecate.read
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/email'
        - $ref: '#/components/parameters/msisdn'
        - $ref: '#/components/parameters/nif'
        - $ref: '#/components/parameters/documentType'
        - $ref: '#/components/parameters/document'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Users-user'
        '400':
          description: Email/msisdn/nif parameter required
          $ref: '#/components/responses/400BadRequestGeneric'
        '403':
          $ref: '#/components/responses/403ForbiddenGeneric'

  /orgs/{orgId}/users/tree/full:
    post:
      tags:
        - Users
      summary: Get full customer tree associated to a given document identification
      description: Returns full customer tree data
      operationId: searchUsersFull
      security:
        - permissions:
            - customers.users.tree.extended.read
      parameters:
        - $ref: '#/components/parameters/orgId'
      requestBody:
        description: Contains product data
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserDocumentSearch'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Users-user'
        '400':
          description: Nif parameter required
          $ref: '#/components/responses/400BadRequestGeneric'
        '403':
          $ref: '#/components/responses/403ForbiddenGeneric'

  /orgs/{orgId}/users/{userId}:
    get:
      tags:
        - Users
      summary: Get user detail
      description: Returns user data by userId
      operationId: getInfoUserById
      security:
        - permissions:
            - customers.users.read
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/userId'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '400':
          description: Invalid subscription ID supplied
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: subscription not found
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

  /orgs/{orgId}/users/agile-tv:
    patch:
      tags:
        - Users
      summary: Agile TV change email subscription
      description: Patch users agile tv subscription
      operationId: patchAgileTvSubscription
      security:
        - permissions:
            - customers.users.agiletv.update
      parameters:
        - $ref: '#/components/parameters/orgId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchAgileTvSubscriptionRequest'
      responses:
        '200':
          description: successful operation
        '400':
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: AgileTV subscription not found
          $ref: '#/components/responses/404NotFoundGeneric'

  /orgs/{orgId}/signups:
    post:
      tags:
        - Signups
      summary: Post new client
      description: Add new customers including products purchased
      operationId: postSignups
      security:
        - permissions:
            - customers.signups.create
      parameters:
        - $ref: '#/components/parameters/orgId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SignupsRequest'
      responses:
        '200':
          description: signup ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SignupsResponse'
        '202':
          description: Check the risk decision
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SignupsResponse'
        '400':
          $ref: '#/components/responses/400BadRequestGeneric'

  /orgs/{orgId}/signups/master-data:
    get:
      deprecated: true
      tags:
        - Signups
      summary: Get master data information
      description: Returns a list of normalized master-data info related to a given a dealerId
      operationId: getSignupsMasterData
      security:
        - permissions:
            - customers.signups.data.read
      parameters:
        - $ref: '#/components/parameters/orgId'
        - name: dealerId
          in: query
          description: (optional) dealer identifier
          required: false
          schema:
            type: string
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SignupsMasterData'

  /orgs/{orgId}/signups/available-msisdns/{host_cfg}:
    get:
      tags:
        - Signups
      summary: Get available msisdns
      description: Get available msisdns for YOIGO network (only mobile numbers)
      operationId: getAvailableMsisdns
      security:
        - permissions:
            - customers.signups.msisdns.list
      parameters:
        - $ref: '#/components/parameters/orgId'
        - name: host_cfg
          in: path
          description: network id (YOIGO)
          required: true
          schema:
            type: string
            enum:
              - YOIGO
              - ORANGE
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AvailableMsisdns'
        '400':
          description: Invalid network host cfg
          $ref: '#/components/responses/400BadRequestGeneric'

  /orgs/{orgId}/signups/simcard-info/{iccid}:
    get:
      tags:
        - Signups
      summary: Get simcard ICC
      description: Returns simcard info from provided icc
      operationId: getSimcardInfo
      security:
        - permissions:
            - customers.subscriptions.sim.read
      parameters:
        - $ref: '#/components/parameters/orgId'
        - name: iccid
          in: path
          description: icc
          required: true
          schema:
            type: string
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimcardInfoResponse'

  /orgs/{orgId}/signups/activate-sim:
    patch:
      tags:
        - Signups
      summary: Activate SIM card
      description: Allows to activate simcard
      operationId: patchActivateSim
      security:
        - permissions:
            - customers.subscriptions.sim.status.update
      parameters:
        - $ref: '#/components/parameters/orgId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActivateSim'
      responses:
        '200':
          description: activate successful
          content: { }
        '400':
          $ref: '#/components/responses/400BadRequestGeneric'

  /orgs/{orgId}/signups/subscriptions:
    post:
      tags:
        - Signups
      summary: Add new subscription to bundle
      description: Add a new mobile line or tv subscription to an existing convergent account.
      operationId: postAddLineToBundle
      security:
        - permissions:
            - customers.subscriptions.create
      parameters:
        - $ref: '#/components/parameters/orgId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddLineToBundleRequest'
      responses:
        '200':
          description: Add line to bundle ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddLineToBundleResponse'
        '202':
          description: Check the risk decision
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddLineToBundleResponse'
        '400':
          $ref: '#/components/responses/400BadRequestGeneric'

  /workorders/change-order:
    post:
      tags:
        - Workorders
      summary: Post changeOrder mysimWS s calls
      description: Executes changeOrder proxy call to mysimWS
      operationId: changeOrderProxy
      security:
        - permissions:
            - customers.workorders.update
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChangeOrderRequest'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChangeOrderResponse'
        '400':
          $ref: '#/components/responses/400BadRequestGeneric'
        '404':
          description: Seller was not found in MYSIM
          $ref: '#/components/responses/404NotFoundGeneric'
        '405':
          $ref: '#/components/responses/405MethodNotAllowedGeneric'

  /orgs/{orgId}/penalties/{accountId}:
    get:
      tags:
        - Penalties
      summary: Get account penalties by account id
      description: Get account penalties by account id. Two different penalties can be obtained, for unsubscribing or for cancelling
      operationId: getAccountPenalties
      security:
        - permissions:
            - customers.penalties.list
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/accountId'
        - name: reason
          in: query
          description: Reason. Two values are possible, unsubscribe or cancel
          required: true
          schema:
            $ref: '#/components/schemas/AccountPenaltiesReason'
      responses:
        '200':
          description: Account penalties
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ComputedPenalties'
        '400':
          $ref: '#/components/responses/400BadRequestGeneric'

  /orgs/{orgId}/penalties/{accountId}/subscriptions/{subscriptionId}:
    get:
      tags:
        - Penalties
      summary: Get subscription penalties by subscription id
      description: Get account penalties by account and subscription ids. Three different penalties can be obtained, for unsubscribing a broadband subscription, for migrating a subscription that has a device linked to it, or for mobile only unsubscribing
      operationId: getSubscriptionPenalties
      security:
        - permissions:
            - customers.penalties.list
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/accountId'
        - $ref: '#/components/parameters/subscriptionId'
        - name: reason
          in: query
          description: Reason. Three values are possible, broadband_subscription, device or mobile
          required: true
          schema:
            $ref: '#/components/schemas/SubscriptionPenaltiesReason'
      responses:
        '200':
          description: Subscription penalties
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ComputedPenalties'
        '404':
          description: Subscription not found
          $ref: '#/components/responses/404NotFoundGeneric'

  /orgs/{orgId}/penalties/{accountId}/subscriptions/uuid/{subscriptionUUID}:
    get:
      tags:
        - Penalties
      summary: Get subscription penalties by subscription UUID
      description: Get account penalties by account and subscription UUID. Three different penalties can be obtained, for unsubscribing a broadband subscription, for migrating a subscription that has a device linked to it, or for mobile only unsubscribing
      operationId: getSubscriptionPenaltiesByUUID
      security:
        - permissions:
            - customers.penalties.list
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/accountId'
        - $ref: '#/components/parameters/subscriptionUUID'
      responses:
        '200':
          description: Subscription penalties
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ComputedPenalties'
        '404':
          description: Subscription not found
          $ref: '#/components/responses/404NotFoundGeneric'

  /orgs/{orgId}/penalties/{computedPenaltyId}:
    put:
      tags:
        - Penalties
      summary: Put computed penalty
      description: Put computed penalty to confirm penalties. Computed penalty id is obtained through the GET penalties method (account or subscription)
      operationId: putComputedPenalty
      security:
        - permissions:
            - customers.penalties.update
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/computedPenaltyId'
        - name: penalties
          in: query
          description: Optional array of penalties for specific calculation
          required: false
          schema:
            type: array
            items:
              type: integer
      responses:
        '200':
          description: Successful operation
          content: { }
        '404':
          description: Computed penalty id not found
          $ref: '#/components/responses/404NotFoundGeneric'
    delete:
      tags:
        - Penalties
      summary: Delete computed penalty
      description: Deletes already confirmed penalty with PUT method. Computed penalty id is obtained through the GET penalties method (account or subscription)
      operationId: deleteComputedPenalty
      security:
        - permissions:
            - customers.penalties.delete
      parameters:
        - $ref: '#/components/parameters/orgId'
        - $ref: '#/components/parameters/computedPenaltyId'
      responses:
        '200':
          description: Successful operation
          content: { }
        '404':
          description: Computed penalty id not found
          $ref: '#/components/responses/404NotFoundGeneric'

components:
  securitySchemes:
    permissions:
      type: apiKey
      in: header
      name: x-auth-roles
      description: Permissions are retrieved from roles, which come in a header

  parameters:
    # path parameters
    orgId:
      name: orgId
      in: path
      required: true
      description: organization name
      example: telco
      schema:
        type: string
    userId:
      name: userId
      in: path
      required: true
      description: user identifier
      example: 214748364
      schema:
        type: integer
        format: int64
    accountId:
      name: accountId
      in: path
      required: true
      description: account identifier
      example: 214748364
      schema:
        type: integer
        format: int64
    subscriptionId:
      name: subscriptionId
      in: path
      required: true
      description: subscription identifier
      example: 214748364
      schema:
        type: integer
        format: int64
    subscriptionUUID:
      name: subscriptionUUID
      in: path
      required: true
      description: subscription identifier
      example: "123e4567-e89b-12d3-a456-556642440000"
      schema:
        type: string
        format: uuid
    computedPenaltyId:
      name: computedPenaltyId
      in: path
      required: true
      description: computed penalty identifier
      example: 214748364
      schema:
        type: integer
        format: int64
    bonusId:
      name: bonusId
      in: path
      required: true
      description: bonus identifier
      example: 214748364
      schema:
        type: integer
        format: int64
    serviceId:
      name: serviceId
      in: path
      required: true
      description: service identifier
      example: 214748364
      schema:
        type: integer
        format: int64
    blockId:
      name: blockId
      in: path
      required: true
      description: block identifier (only allow 1 or 2)
      example: 214748364
      schema:
        type: integer
        format: int32

    # query parameters
    startDate:
      name: start_date
      in: query
      example: '1970-01-01'
      description: start date query with format yyyy-mm-dd
      required: false
      schema:
        type: string
        format: date
    endDate:
      name: end_date
      in: query
      example: '1970-01-01'
      description: end date query with format yyyy-mm-dd
      required: false
      schema:
        type: string
        format: date
    email:
      name: email
      in: query
      example: john.doe@example.com
      description: user email
      schema:
        type: string
    msisdn:
      name: number
      in: query
      example: '12345'
      description: user phone number (MSISDN)
      schema:
        type: string
    nif:
      name: nif
      in: query
      example: 12345678A
      description: Deprecated use documentType and document (user nif)
      deprecated: true
      schema:
        type: string
    documentType:
      name: documentType
      in: query
      example: NIF
      description: Document type id
      schema:
        $ref: '#/components/schemas/DocumentTypeSearch'
    document:
      name: document
      in: query
      example: 12345678A
      description: Document with numbers and letters
      schema:
        type: string

    # headers
    ipAddress:
      name: x-ip-address
      in: header
      example: 192.168.1.1
      description: origin ip address
      required: false
      schema:
        type: string
        format: ipv4
    includeHistoricalChanges:
      name: include_historical_changes
      in: query
      example: true
      description: true when you want to include historical changes
      required: false
      schema:
        type: boolean
    historicalChangesStartDate:
      name: historical_changes_start_date
      in: query
      example: '1970-01-01T00:00:00Z'
      description: start date that you want query historical changes with format yyyy-mm-ddThh:MM:ssZ
      required: false
      schema:
        type: string
        format: date-time
    historicalChangesEndDate:
      name: historical_changes_end_date
      in: query
      example: '1970-01-01T00:00:00Z'
      description: end date that you want query historical changes with format yyyy-mm-ddThh:MM:ssZ
      required: false
      schema:
        type: string
        format: date-time

  responses:
    400BadRequestGeneric:
      description: Invalid request body
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
    401UnauthorizedGeneric:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
          example:
            code: 0003
            status: UNAUTHORIZED
            message: Unauthorized
            DetailMsg: Tenant XXX could not be validated
    403ForbiddenGeneric:
      description: Forbidden resource
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
          example:
            code: 10
            status: FORBIDDEN
            message: Forbidden
            DetailMsg: The state does not allow login
    404NotFoundGeneric:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
    405MethodNotAllowedGeneric:
      description: Method not allowed
      content: { }
    500InternalServerErrorGeneric:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
          example:
            code: 0002
            status: UNEXPECTED
            message: Unexpected error
            DetailMsg: "com.masorange.mcus.core.application.errors.UnexpectedException: Unexpected error"

  schemas:
    FinancialDetails:
      type: object
      additionalProperties: false
      properties:
        pre_booking:
          type: object
          deprecated: true
          additionalProperties: false
          properties:
            order_id:
              type: string
            authorization_id:
              type: string
              maxLength: 20
            financial_entity:
              type: string
              maxLength: 50
            status:
              type: string
              enum:
                - Accepted
                - Rejected
            granted_amount:
              type: integer
              format: int64
              minimum: 0
              maximum: 999999999
            credit_line_amount:
              type: integer
              format: int64
              minimum: 0
              maximum: 999999999
            total_client_financed_value:
              type: number
              format: double
              minimum: 0.00
              maximum: 999999999.99
        consents:
          type: object
          additionalProperties: false
          properties:
            commercial:
              type: boolean
            gdpr:
              type: boolean
    ChangeOrderRequest:
      type: object
      required: [ "seller", "workorderid", "changetype" ]
      properties:
        seller:
          type: string
        workorderid:
          type: string
        reason:
          type: string
        parameters:
          type: string
        changetype:
          type: string

    ChangeOrderResponse:
      type: object
      properties:
        errorVO:
          $ref: '#/components/schemas/ErrorVO'

    ErrorVO:
      type: object
      properties:
        error_code:
          type: string
        error_description:
          type: string
        operation_date:
          type: string

    ServiceStatus:
      type: object
      properties:
        active:
          type: boolean
          example: true
          description: active = True - Activate a service <br> active = False - Deactivate a service

    BlockStatus:
      type: object
      required:
        - active
      properties:
        active:
          type: boolean
          example: true
          description: active = True - Activate a service <br> active = False - Deactivate a service
        reason:
          type: string
          example: Lo ha perdido
          description: Describes the reason to block the simcard

    Service:
      type: object
      properties:
        id:
          type: integer
          format: int64
          description: Id service
          example: 214748364
        value:
          type: string
          description: Service Name
          example: VOZ
        changeable:
          type: boolean
          description: indicates whether the service can be changed
          example: true
        date_last_modified:
          type: string
          format: date-time
          example: "2017-09-15T22:00:00Z"
          description: date last modified
        active:
          type: boolean
          description: indicates whether the service is active
          example: true

    Block:
      type: object
      properties:
        id:
          type: integer
          format: int64
          description: Block identification
          example: 214748364
        value:
          type: string
          description: Block Name
          example: ROBO
        date_last_modified:
          type: string
          format: date-time
          example: "2017-09-15T22:00:00Z"
          description: date last modified
        description:
          type: string
          description: description of the reason block
          example: A PETICION DE CLIENTE

    AccountBundlePromotion:
      type: object
      properties:
        promotion_id:
          type: integer
          format: int64
          description: promotion id
        effective_date_ini:
          type: string
          format: date-time
          example: "2017-09-15T22:00:00Z"
          description: promotion initial effective date
        effective_date_end:
          type: string
          format: date-time
          example: "2017-09-15T22:00:00Z"
          description: promotion end effective date
        promotion_name:
          type: string
          description: promotion name
        account_bundle_id:
          type: integer
          format: int64
        promotion_benefit_type:
          $ref: '#/components/schemas/PromotionBenefitType'
        promotion_type:
          $ref: '#/components/schemas/PromotionType'

    AccountPromotion:
      type: object
      properties:
        promotion_id:
          type: integer
          format: int64
          description: promotion id
        begin_date:
          type: string
          format: date-time
          example: "2017-09-15T22:00:00Z"
          description: promotion activation date
        promotion_name:
          type: string
          description: promotion name
        end_date:
          type: string
          format: date-time
          example: "2017-09-15T22:00:00Z"
          description: promotion end date
        promotion_benefit_type:
          $ref: '#/components/schemas/PromotionBenefitType'
        promotion_type:
          $ref: '#/components/schemas/PromotionType'

    SubscriptionPromotion:
      type: object
      properties:
        subscription_id:
          type: integer
          format: int64
          example: 214748364
          description: subscription id
        promotion_id:
          type: integer
          format: int64
          example: 214748364
          description: promotion id
        promotion_code:
          type: string
          example: NTH_256
          description: promotion code
        promotion_name:
          type: string
          example: MM_50% DTO_CONVERGENCIA_FIDELIZACIÓN_12_MESES
          description: promotion name
        association_date:
          type: string
          format: date-time
          example: "2017-09-15T22:00:00Z"
          description: promotion association date
        end_date:
          type: string
          format: date-time
          example: "2017-09-15T22:00:00Z"
          description: promotion end date
        account_bundle_id:
          type: integer
          format: int64
          example: 214748364
        promotion_benefit_type:
          $ref: '#/components/schemas/PromotionBenefitType'
        promotion_type:
          $ref: '#/components/schemas/PromotionType'

    AccountTerms:
      type: object
      properties:
        subscription_id:
          type: integer
          format: int64
          example: 214748364
          description: subscription id
        start_date:
          type: string
          format: date-time
          example: "2017-09-15T22:00:00Z"
          description: start date
        end_date:
          type: string
          format: date-time
          example: "2017-09-15T22:00:00Z"
          description: end date
        penalty_amount:
          type: number
          format: double
          example: 0.0
          description: terms penalty amount
        terms_months:
          type: integer
          format: int32
          example: 12
          description: terms months
        account_bundle_id:
          type: integer
          format: int64
          example: 214748364
          description: account bundle id
        binding_type:
          $ref: '#/components/schemas/BindingType'
        promotion:
          $ref: '#/components/schemas/AccountTermsPromotion'
        associated_type:
          type: string
          description: Type of permanence to which it is associated
          enum:
            - terminal
            - promotion
        associated_terminal:
          $ref: '#/components/schemas/AccountTermsAssociatedTerminal'

    AccountTermsPromotion:
      allOf:
        - $ref: '#/components/schemas/BasicIdResponse'
        - type: object
          description: Promotion to which the permanence is associated to
          properties:
            description:
              type: string
              description: Brief description of the promotion
              example: "PERMANENCIA TERMINAL 150E 24M"

    AccountTermsAssociatedTerminal:
      allOf:
        - $ref: '#/components/schemas/BasicIdResponse'
        - type: object
          description: Returned in case the associated_type has value "terminal", with id and name of the terminal

    BasicIdResponse:
      type: object
      properties:
        id:
          type: integer
          format: int32
          description: Identificator
        value:
          type: string
          description: Name

    Bonus:
      type: object
      properties:
        id:
          type: integer
          format: int64
          description: bonus identifier
          example: 214748364
        value:
          type: string
          description: Bonus Name
          example: INTERNET 3GB TPILI
        start_date:
          type: string
          format: date-time
          example: "2017-09-15T22:00:00Z"
          description: bonus start date
        end_date:
          type: string
          format: date-time
          example: "2017-09-15T22:00:00Z"
          description: bonus end date

    SubscriptionDevices:
      type: object
      properties:
        devices:
          type: array
          items:
            $ref: '#/components/schemas/DeviceResponse'

    RequestDetail:
      type: object
      description: request detail
      properties:
        created_date:
          type: string
          format: date-time
          description: created date
          example: "2017-09-15T22:00:00Z"
        request_id:
          type: integer
          format: int64
          description: request id
          example: 214748364
        request_type:
          type: string
          description: request type
          example: captacion
        user_profile_role:
          type: string
          description: user profile role
          example: Generic

    DeviceInfo:
      type: object
      description: device info
      properties:
        terminal_id:
          type: integer
          format: int32
          description: terminal id
          example: 214748364
        serial_number:
          type: string
          description: serial number
          example: 0
        device_name:
          type: string
          description: device name
          example: Honor 90 Smart 5G
        device_model:
          type: string
          description: device model
          example: 128GB Midnight Black
        financed_by:
          type: string
          description: financed by. Current operational financial, taking into account the number of pending installments
          example: XFERA
          deprecated: true
        is_financed:
          type: boolean
          description: is financed
          example: false
        value_due_today:
          type: number
          format: double
          description: value due today
          example: 120.00
        reservation_id:
          type: string
          description: reservation id
          example: e528d8ec-831f-40e9-8414-8ef7cc99c4e4
        paid:
          type: boolean
          description: paid
          example: false
        terminal_code:
          type: string
          description: Catalog terminal code
          example: PV00000
        terminal_category_type:
          type: string
          description: Catalog terminal category type
          example: SMARTPHONE

    Fees:
      type: object
      description: device info
      properties:
        upfront_fee:
          type: number
          format: double
          description: upfront fee (initial payment)
          example: 0
        installment_plan:
          $ref: '#/components/schemas/InstallmentPlan'
        final_installment_plan:
          $ref: '#/components/schemas/InstallmentPlan'

    DeviceFees:
      type: object
      description: device fees info
      required:
        - upfront_fee
      additionalProperties: false
      properties:
        upfront_fee:
          type: number
          format: double
          minimum: 0.00
          maximum: 999999999.99
        installment_plan:
          $ref: '#/components/schemas/DeviceInstallmentPlan'

    DeviceInstallmentPlan:
      type: object
      additionalProperties: false
      properties:
        commission:
          type: number
          format: double
          minimum: 0.00
          maximum: 999999999.99
        tae:
          type: number
          format: double
          minimum: 0.00
          maximum: 999999999.99
        tin:
          type: number
          format: double
          minimum: 0.00
          maximum: 999999999.99
        duration:
          type: integer
          minimum: 1
          maximum: 9999
        monthly_fee:
          type: number
          format: double
          minimum: 0.00
          maximum: 999999999.99
        last_installment_fee:
          type: number
          format: double
          minimum: 0.00
          maximum: 999999999.99
        discount_final_payment_value:
          type: number
          format: double
          minimum: 0.00
          maximum: 999999999.99
          nullable: true
        is_promotional_renew:
          type: boolean
          nullable: true

    Terms:
      type: object
      additionalProperties: false
      properties:
        penalty_value:
          type: number
          format: double
          minimum: 0.00
          maximum: 999999999.99
        commitment_duration:
          type: integer
          minimum: 0
          maximum: 9999

    SignatureType:
      type: string
      enum:
        - PAPER
        - OTP
        - BIOMETRIC
        - UNKNOWN
      nullable: true

    InstallmentPlan:
      type: object
      description: request detail
      properties:
        last_installment_fee:
          type: number
          format: double
          description: final payment
          example: 0.0
        monthly_fee:
          type: number
          format: double
          description: monthly fee
          example: 6.00
        duration:
          type: integer
          format: int32
          description: duration (total permanence)
          example: 0
        unpaid_installments:
          type: integer
          format: int32
          description: pending fees
          example: 10
        financed_by:
          type: string
          description: financed by
          example: XFERA

    Permanence:
      type: object
      description: permanence info
      properties:
        duration_months:
          type: integer
          format: int32
          description: duration months configured
          example: 24
        current_duration_days:
          type: number
          format: int32
          description: duration months in days, calculated from the current date until the end of the permanence
          example: 120
        penalty_amount:
          type: number
          format: double
          description: amount of the penalty configured
          example: 120.50
        current_penalty_amount:
          type: number
          format: double
          description: amount of the penalty calculated from the current date until the end of the permanence
          example: 120.50

    DeviceResponse:
      type: object
      properties:
        subscription_id:
          type: integer
          format: int64
          description: identification subscription
          example: 214748364
        subscription_terminal_id:
          type: integer
          format: int64
          description: subscription terminal id
          example: 214748364
        delivery_date:
          type: string
          format: date-time
          description: Delivery date for subscription terminal in format ISO-8601 (RFC 3339)
          example: "2024-10-15T14:30:00Z"
        status:
          $ref: '#/components/schemas/StatusDevices'
        request_detail:
          $ref: '#/components/schemas/RequestDetail'
        device_info:
          $ref: '#/components/schemas/DeviceInfo'
        fees:
          $ref: '#/components/schemas/Fees'
        permanences:
          $ref: '#/components/schemas/Permanence'

    InvoiceInfoList:
      type: object
      required:
        - account_id
        - period_date
        - invoices
      properties:
        account_id:
          type: integer
          format: int64
          description: account identifier
        period_date:
          $ref: '#/components/schemas/PeriodDate'
        invoices:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceInfoDetail'

    InvoiceInfoDetail:
      type: object
      required:
        - value
        - delivery_mode
        - date
      properties:
        value:
          type: number
          format: double
          description: invoice value
          example: 47.89
        value_total:
          type: number
          format: double
          description: invoice total pay or invoice total value
          example: 55.19
        delivery_mode:
          type: string
          description: invoice delivery mode
          enum:
            - yosoymas
            - paper
            - email
        date:
          type: string
          description: invoice date
          format: date-time
          example: "2017-09-15T22:00:00Z"
        pay_date:
          type: string
          description: Payment date
          format: date-time
          example: "2017-09-15T22:00:00Z"
        number:
          type: string
          description: invoice identifier number
          example: "MM12123445"
        path:
          type: string
          description: invoice PDF file path
          example: "/path/to/invoices/20120716/XYZ_AB12345.pdf"
        status:
          type: object
          description: Invoice status
          properties:
            id:
              type: integer
              format: int32
              example: 2
            value:
              type: string
              example: "PAGADO"
        cycle:
          type: object
          properties:
            start_date:
              type: string
              format: date-time
              description: start date of the period. Format yyyy-MM-dd
              example: '2030-01-01T12:13:11Z'
            end_date:
              type: string
              format: date-time
              description: end date of the period. Format yyyy-MM-dd
              example: '2030-01-17T12:13:11Z'


    AccountInfo:
      type: object
      properties:
        id:
          type: integer
          format: int64
          description: id de la cuenta
          example: 214748364
        customer_id:
          type: integer
          format: int64
          description: id del cliente
          example: 214748364
        account_number:
          type: string
          description: numero de contrato
          example: "MM-5338507"
        work_order_id:
          type: string
          deprecated: true
          description: work order identifier. DEPRECATED, this info is in work_orders list
          example: "FOO_XYZ"
        work_orders:
          type: array
          items:
            $ref: '#/components/schemas/WorkOrder'
          description: list of ot associated to a package
        activation_date:
          type: string
          description: account activation date
          format: date-time
          example: "2019-12-09T09:58:34Z"
        billing_type:
          $ref: '#/components/schemas/BillingType'
        status:
          $ref: '#/components/schemas/AccountStatus'
        path:
          type: string
        filename:
          type: string

    WorkOrder:
      type: object
      required:
        - work_order_id
        - work_order_type
        - status
      properties:
        work_order_id:
          type: string
          example: "FOO_XYZ"
          description: identification work order
        work_order_type:
          $ref: '#/components/schemas/WorkOrderType'
        status:
          $ref: '#/components/schemas/WorkOrderStatus'
        created_date:
          type: string
          description: work order create date
          format: date-time
          example: "2019-12-09T09:58:34Z"

    WorkOrderType:
      type: object
      properties:
        id:
          type: integer
          format: int32
          description: identification work order type
          example: 1
          enum:
            - 1
            - 2
            - 3
            - 4
            - 5
            - 6
            - 7
            - 8
            - 9
            - 10
            - 11
            - 12
            - 13
            - 14
            - 15
            - 16
            - 17
            - 18
            - 19
            - 20
            - 21
        value:
          type: string
          description: Subscription status value
          example: "ALTA"
          enum:
            - ALTA
            - BAJA
            - CAMBIO VELOCIDAD
            - SUSPENSIÓN
            - RECONEXIÓN
            - CANCELACION
            - ALTA SVA
            - BAJA SVA
            - CAMBIO TECNOLOGIA
            - FTTH->ADSL
            - CANCELACION PARCIAL
            - SVA VENTA
            - SVA BUSINESS
            - ALTA MIFIJO
            - BAJA MIFIJO
            - CANCELACION MIFIJO
            - CAMBIO DOMICILIO
            - CANCELACION CAMBIO DOMICILIO
            - CANCELACION CAMBIO TECNOLOGIA
            - BAJA CAMBIO DOMICILIO
            - BAJA CAMBIO TECNOLOGIA

    WorkOrderStatus:
      type: object
      required:
        - id
        - value
      properties:
        id:
          type: integer
          format: int32
          description: identification work order status
          example: 32
          enum:
            - 32
            - 33
            - 34
            - 36
            - 37
            - 38
            - 44
            - 48
            - 51
            - 58
            - 69
        value:
          type: string
          description: Subscription status value
          example: PENDIENTE CREAR OT
          enum:
            - PENDIENTE CREAR OT
            - ENVIADA
            - CANCELADA
            - CERRADA
            - CONFIRMADA
            - INFORMACION ERRONEA
            - PENDIENTE CREAR OT BY SELL
            - CERRADO EN BUS
            - OT PENDING SEND BY FRAUD
            - SUSPENCION TECNICA
            - EN PROGRESO

    TaxAccountInfo:
      type: object
      required:
        - id
        - tax_value
        - state_id
      properties:
        id:
          type: integer
          format: int64
          description: account id
        tax_value:
          type: integer
          format: int32
          description: value tax
          example: 21
        tax_terminal_value:
          type: integer
          format: int32
          description: value terminal tax
          example: 21
        state_id:
          type: integer
          format: int32
          description: ID of the state
          example: 28
        description:
          type: string
          description: description of the type tax (IVA, IGIC, etc..)
          example: IVA
        start_date:
          type: string
          format: date-time
          description: Date when the customer moved into the current state
          example: '1970-01-01T00:00:00Z'
        historical_changes:
          type: array
          items:
            $ref: '#/components/schemas/TaxAccountInfoHistoricalChange'

    TaxAccountInfoHistoricalChange:
      type: object
      required:
        - tax_value
        - state_id
        - start_date
        - end_date
      properties:
        tax_value:
          type: integer
          format: int32
          description: value tax
          example: 21
        tax_terminal_value:
          type: integer
          format: int32
          description: value terminal tax
          example: 21
        state_id:
          type: integer
          format: int32
          description: ID of the state
          example: 28
        description:
          type: string
          description: description of the type tax (IVA, IGIC, etc..)
          example: IVA
        start_date:
          type: string
          format: date-time
          description: init of the period that the account has this state
          example: '1970-01-01T00:00:00Z'
        end_date:
          type: string
          format: date-time
          description: end of the period that the account has this state
          example: '1970-01-01T00:00:00Z'

    UsersAccount:
      type: object
      properties:
        account_id:
          type: integer
          format: int64
          description: id de la cuenta
        status:
          $ref: '#/components/schemas/AccountStatus'


    Subscription:
      type: object
      properties:
        id:
          type: integer
          description: ID of subscription to return
          example: 214748364
          format: int64
        subscription_status:
          $ref: '#/components/schemas/Status'
        sell_date:
          type: string
          format: date-time
          example: "2017-09-15T22:00:00Z"
        activated_date:
          type: string
          format: date-time
          example: "2017-09-15T22:00:00Z"
        end_date:
          type: string
          format: date-time
          example: "2017-09-15T22:00:00Z"
        subscription_type:
          $ref: '#/components/schemas/SubscriptionType'
        origin:
          $ref: '#/components/schemas/Origin'
        historical_status:
          type: array
          items:
            $ref: '#/components/schemas/HistoricalStatus'
        dealer_id:
          type: string
          nullable: true
          description: Dealer id (in some cases this field can be null)
        shop_id:
          type: string
          nullable: true
          description: Shop id (in some cases this field can be null)
        path:
          type: string
          nullable: true
          description: Contract path (in some cases this field can be null)
        filename:
          type: string
          nullable: true
          description: Contract filename (in some cases this field can be null)
        identification_nr:
          type: integer
          format: int32
          description: Phone number associated to subscription
          example: 12345
        imsi:
          type: integer
          format: int64
          nullable: true
          description: IMSI associated to mobile subscription (in some cases this field can be null)
          example: 214035453370793
        iccid:
          type: string
          nullable: true
          description: Mobile online icc id (in some cases this field can be null)
          example: 8934011411551283144

    HistoricalStatus:
      type: object
      properties:
        subscription_status:
          $ref: '#/components/schemas/Status'
        date:
          type: string
          format: date-time
          example: "2017-09-15T22:00:00Z"
        modified_by:
          type: string
          example: "somebody"

    PromotionBenefitType:
      type: object
      properties:
        id:
          type: integer
          format: int32
          description: Promotion Benefit Type Id
          enum:
            - 1
            - 2
        value:
          type: number
          format: double

    BindingType:
      type: object
      properties:
        id:
          type: integer
          format: int32
          example: 214748364
        value:
          type: string
          example: "12 MESES"

    MovementType:
      type: object
      properties:
        id:
          type: integer
          format: int32
          example: 214748364
        value:
          type: string
          description: Reason of movement
          example: "PENALIZACION CANCELACION"
        description:
          type: string
          description: Brief description of reason
          example: "FIBRA CUOTA PENALIZACIÓN"

    RechargeOrigin:
      type: object
      description: recharge origin
      properties:
        id:
          type: number
          format: int32
          example: 214748364
        value:
          type: string
          example: "TPV"

    PromotionType:
      type: object
      properties:
        id:
          type: integer
          format: int32
          enum:
            - 1
            - 2
            - 3
            - 4
            - 5
        value:
          type: string
          description: M2M, OCU, EMPRESAS, OTRAS, PAQUETE

    BillingType:
      type: object
      properties:
        id:
          type: integer
          format: int32
          description: Identification billing type
          enum:
            - 1
            - 2
            - 3
        value:
          type: string
          description: description billing type
          enum:
            - POSPAGO
            - PREPAGO CLASICO
            - RECARGA AUTOMATICA

    PaymentInfo:
      type: object
      description: Info payment
      properties:
        payment_method:
          $ref: '#/components/schemas/PaymentMethod'
        bank_account:
          $ref: '#/components/schemas/BankAccount'
        credit_card:
          $ref: '#/components/schemas/CreditCard'

    PaymentMethod:
      type: string
      nullable: false
      enum:
        - BANK_ACCOUNT
        - BANK_TRANSFER
        - CREDIT_CARD
        - ECI
        - RECURRING_CREDIT_CARD

    BankAccount:
      type: object
      properties:
        entity:
          type: string
          description: Bank entity
        subsidiary:
          type: string
          description: Subsidiary
        control_digit:
          type: string
          description: Control digit
        number:
          type: string
          description: Bank account number
        iban:
          type: string
          description: Account iban

    CreditCard:
      type: object
      properties:
        reference:
          type: string
        type_id:
          type: number
          format: int32
        number:
          type: string
        validity_date:
          type: string

    LanguageType:
      type: object
      allOf:
        - anyOf:
            - $ref: '#/components/schemas/LanguageTypeId'
            - $ref: '#/components/schemas/LanguageTypeIso'
        - type: object
          description: Value
          properties:
            value:
              type: string
              nullable: false
              description: language value
              example: Castellano
              enum:
                - Castellano
                - Catalan
                - Galego
                - Vasco
                - Ingles
                - Portugues

    LanguageTypeId:
      type: object
      nullable: false
      required:
        - id
      properties:
        id:
          type: integer
          format: int32
          nullable: false
          description: language identification
          example: 90
          enum:
            - 90
            - 91
            - 92
            - 93
            - 96
            - 97

    LanguageTypeIso:
      type: object
      nullable: false
      required:
        - iso
      properties:
        iso:
          type: string
          nullable: false
          description: language iso code
          example: es
          enum:
            - es
            - ca
            - gl
            - eu
            - en
            - pt

    SubscriptionType:
      type: object
      required:
        - id
        - value
      properties:
        id:
          type: integer
          format: int32
          description: identification subscription type
          enum:
            - 1
            - 2
            - 3
            - 4
            - 5
            - 6
            - 7
            - 8
            - 9
            - 10
            - 11
            - 12
            - 13
        value:
          type: string
          description: Subscription type name
          enum:
            - PRE-PAGO
            - POST-PAGO
            - FIJO ANALOGICO
            - FIJO DIGITAL
            - INTERNET ADSL
            - INTERNET FTTH
            - AGILE TV
            - SECURITY
            - DATA_SHARING
            - MULTISIM
            - DEVICEINSURANCE
            - NETFLIX
            - APPLEWATCH

    SubscriptionProduct:
      type: object
      required:
        - id
        - product
      properties:
        id:
          type: integer
          format: int64
          description: identification subscription
          example: 214748364
        product:
          $ref: '#/components/schemas/Product'
        bundle:
          $ref: '#/components/schemas/Bundle'
        historical_changes:
          type: array
          description: Tariff change history, ordered by datetime in descending order. The current tariff is always included at the top of the list.
          items:
            $ref: '#/components/schemas/HistoricalProduct'

    ChangeSubscriptionProductRequest:
      type: object
      required:
        - productId
      properties:
        productId:
          type: integer
          format: int64
          description: target product identifier
          example: 214748364
        scheduled_date:
          type: string
          format: date
          description: Desired date to execute operation

    SubscriptionBonusesRequest:
      type: object
      required:
        - bonusId
      properties:
        bonusId:
          type: integer
          format: int64
          description: bonus ID to add
          example: 214748364
        scheduled_date:
          type: string
          format: date
          description: Desired date to execute operation

    HistoricalProduct:
      type: object
      properties:
        id:
          type: integer
          format: int32
          example: 214748364
          description: identification product
        value:
          type:
            string
          description: name product
          example: "TARIFA MAS 10GB CONV"
        historic_date:
          type: string
          format: date-time
          description: Last date change of rate.
          example: "2020-05-05T12:29:22Z"

    Product:
      allOf:
        - $ref: '#/components/schemas/HistoricalProduct'
        - properties:
            compatibilities:
              type: array
              description: Rates compatibles.
              items:
                $ref: '#/components/schemas/Product'
            scheduled:
              $ref: '#/components/schemas/ScheduledProduct'


    ScheduledProduct:
      type: object
      description: Scheduled product change date, return this item only if you have a rate change scheduled
      properties:
        request_date:
          type: string
          format: date-time
          example: "2020-05-05T12:29:22Z"
        process_date:
          type: string
          format: date-time
          example: "2020-05-06T12:29:22Z"
        scheduled_date:
          type: string
          format: date-time
          example: "2020-05-06T12:29:22Z"
        destination_product:
          $ref: '#/components/schemas/Product'

    Bundle:
      type: object
      properties:
        id:
          type: integer
          format: int32
          description: identification bundle
          example: 214748364
        value:
          type: string
          description: name bundle
          example: "FIBRA 600Mb INDIRECTA + TARIFA MÁS 10GB"

    AccountStatus:
      type: object
      properties:
        id:
          type: integer
          format: int32
          description: account status
          enum:
            - 3
            - 6
            - 7
            - 11
            - 13
        value:
          type: string
          description: name of account status
          enum:
            - ACTIVO
            - TERMINADO
            - BLOQUEO TEMPORAL
            - PENDIENTE DE REVISIÓN
            - PENDIENTE DE ACEPTACION

    Status:
      type: object
      required:
        - id
        - value
      properties:
        id:
          type: integer
          format: int32
          description: identification subscription status
          enum:
            - 1
            - 2
            - 3
            - 4
            - 6
            - 7
            - 9
            - 10
            - 12
            - 39
            - 40
            - 46
            - 50
            - 82
            - 99
        value:
          type: string
          description: Subscription status value
          enum:
            - INSTALADO
            - PRE-ACTIVADO
            - ACTIVO
            - BLOQUEO POR SALDO
            - TERMINADO
            - BLOQUEO TEMPORAL
            - PENDIENTE TERMINACION
            - BLOQUEO LIMITE CONSUMO
            - BLOQUEO POR IMPAGO
            - SUSPENSION PENDIENTE
            - RECONEXION PENDIENTE
            - OK
            - PENDIENTE BLOQUEO TEMPORAL
            - PENDIENTE A DESACTIVAR
            - BLOQUEO POR RIESGO

    StatusDevices:
      type: object
      description: status device
      required:
        - id
        - value
      properties:
        id:
          type: integer
          format: int32
          description: identification device status
          example: 214748364
        value:
          type: string
          description: Device status value
          example: ACTIVO

    Origin:
      type: object
      description: to get origin use in url object query with include = origin. /subscriptions/{id}?query={"include":["origin"]}
      properties:
        id:
          type: integer
          example: 214748364
          format: int32
          description: identification origin
          enum:
            - 1
            - 2
            - 3
            - 4
            - 5
            - 6
            - 7
            - 8
            - 9
            - 10
        value:
          type: string
          example: NUEVA
          description: name of origin
          enum:
            - NUEVA
            - PORTABILIDAD
            - CENTRO DE ATENCION AL CLIENTE
            - MIGRACION CONTRATO
            - REEMPLAZO
            - YOSOYMAS
            - PORTAL DE DISTRIBUICION
            - CANAL ONLINE (AFILIADO)
            - MARCA BLANCA (MAYORISTA)
            - PORTABILIDAD MARCAS

    Promotions:
      type: object
      properties:
        subscription_promotions:
          type: array
          items:
            $ref: '#/components/schemas/SubscriptionPromotion'
        account_promotions:
          type: array
          items:
            $ref: '#/components/schemas/AccountPromotion'
        account_bundle_promotions:
          type: array
          items:
            $ref: '#/components/schemas/AccountBundlePromotion'


    SubscriptionBonus:
      type: object
      properties:
        id:
          type: integer
          format: int64
          description: identification subscription
          example: 214748364
        items:
          type: array
          items:
            $ref: '#/components/schemas/Bonus'

    SubscriptionServices:
      type: object
      properties:
        subscription_id:
          type: integer
          format: int64
          description: identification subscription
        items:
          type: array
          items:
            $ref: '#/components/schemas/Service'

    SubscriptionBlocks:
      type: object
      properties:
        subscription_id:
          type: integer
          format: int64
          description: identification subscription
        items:
          type: array
          items:
            $ref: '#/components/schemas/Block'

    PeriodDate:
      type: object
      properties:
        start_date:
          type: string
          format: date
          description: start date of the period. Format yyyy-MM-dd
          example: '2020-05-01'
        end_date:
          type: string
          format: date
          description: end date of the period. Format yyyy-MM-dd
          example: '2020-05-27'

    SubscriptionDetailRecharge:
      type: object
      properties:
        subscription_id:
          type: integer
          format: int64
          description: identification subscription
          example: 214748364
        identification_nr:
          type: integer
          format: int32
          description: number of identification
          example: 12345
        period_date:
          $ref: '#/components/schemas/PeriodDate'
        recharges:
          type: array
          items:
            $ref: '#/components/schemas/DetailRechargeEvent'

    DetailRechargeEvent:
      type: object
      description: recharge detail record
      properties:
        recharge_id:
          type: integer
          format: int64
          description: unique identification for recharge
          example: 214748364
        date:
          type: string
          format: date-time
          description: recharge date
          example: '2020-05-17T12:13:11Z'
        movement_type_id:
          type: integer
          format: int32
          description: movement type identifier
          example: 214748364
        origin_id:
          type: integer
          format: int32
          description: recharge origin identifier
          example: 214748364
        amount:
          type: number
          format: double
          description: recharge value for current msisdn and date
          example: 0.0

    User:
      type: object
      required:
        - id
        - document_type
        - document_value
        - type
      properties:
        id:
          type: integer
          format: int64
          nullable: false
          example: 214748364
        customer_id:
          type: integer
          format: int64
          nullable: false
          example: 214748364
        language:
          $ref: '#/components/schemas/LanguageType'
        document_type:
          $ref: '#/components/schemas/DocumentType'
        document_value:
          type: string
          nullable: false
          example: "11111111A"
        sector:
          $ref: '#/components/schemas/UserSector'
        type:
          $ref: '#/components/schemas/UserType'
        nationality:
          $ref: '#/components/schemas/Nationality'
        personal:
          $ref: '#/components/schemas/Personal'
        business:
          $ref: '#/components/schemas/Business'
        address_info:
          $ref: '#/components/schemas/UserAddress'

    Users-user:
      type: object
      required:
        - id
        - customer_id
      properties:
        id:
          type: integer
          format: int64
          description: User id
          example: 214748364
        customer_id:
          type: integer
          format: int64
          description: Customer id
          example: 214748364
        customer_uuid:
          type: string
          format: uuid
          description: Customer UUID from customers API V4
          example: "123e4567-e89b-12d3-a456-556642440000"
        accounts:
          type: array
          description: Accounts associated to user
          items:
            $ref: '#/components/schemas/Users-account'

    Users-account:
      type: object
      required:
        - id
        - owner_id
      properties:
        id:
          type: integer
          format: int64
          description: Account id
          example: 214748364
        owner_id:
          type: integer
          format: int64
          description: User id owner of the account
          example: 214748364
        subscriptions:
          type: array
          description: Subscriptions associated to account
          items:
            $ref: '#/components/schemas/Users-subscription'

    Users-subscription:
      type: object
      required:
        - id
        - subscription_type
        - status
        - user_id
        - identification_nr
      properties:
        id:
          type: integer
          format: int64
          description: Subscription id
          example: 214748364
        subscription_type:
          $ref: '#/components/schemas/SubscriptionType'
        status:
          $ref: '#/components/schemas/Status'
        user_id:
          type: integer
          format: int64
          description: User id owner of the subscription
          example: 214748364
        identification_nr:
          type: integer
          format: int64
          description: Number of identification
          example: 12345
        expedition_user_id:
          type: integer
          format: int64
          example: 214748364
        bundle_id:
          type: integer
          format: int64
          description: Bundle in which subscription is included, if so
          example: 214748364
        mobile_line_type:
          type: string
          description: Type of line, only applicable to mobile subscriptions. In case the line does not belong to a
            bundled account, then its value will be always mobile. Otherwise, main, extra and additional
            refers to the type of each mobile line in the bundled account.
          enum:
            - mobile
            - main
            - extra
            - additional

    Personal:
      type: object
      required:
        - first_name
      nullable: true
      properties:
        first_name:
          type: string
          nullable: true
          description: Person's name
          example: John
        middle_name:
          type: string
          nullable: true
          description: Person's middle name
          example: Nicholas
        last_name:
          type: string
          nullable: true
          description: Person's last name
          example: Doe
        gender:
          type: string
          nullable: true
          description: Male or female
          enum:
            - M
            - F
        birthdate:
          type: string
          nullable: true
          format: 'date'
          description: Birthdate
        other_phone:
          type: string
          nullable: true
          description: Additional phone of contact
          example: 12345
        email:
          type: string
          nullable: true
          description: Email of contact
          example: john.doe@example.com

    Business:
      type: object
      required:
        - company
      nullable: true
      properties:
        company:
          type: string
          nullable: true
          description: Name of the company
          example: "SPACEX"
        created_date:
          type: string
          nullable: true
          format: 'date'
          description: Date of creation of the company
        other_phone:
          type: string
          nullable: true
          description: Additional phone of contact
          example: 12345
        email:
          type: string
          nullable: true
          description: Email of contact
          example: john.doe@example.com
        responsable:
          $ref: '#/components/schemas/UserBusinessResponsable'

    UserBusinessResponsable:
      type: object
      description: Person assigned as responsable of the company
      properties:
        id:
          type: integer
          format: int64
          description: Responsable id
          example: 214748364
        name:
          type: string
          example: John
        middlename:
          type: string
          example: Nicholas
        lastname:
          type: string
          example: Doe
        document_type_id:
          type: integer
          format: int32
          enum:
            - 1
            - 3
            - 4
            - 5
          example: 1
        document_value:
          type: string
          example: 11111111A
        nationality_id:
          type: number
          format: int32
          example: 214748364
        nationality_iso:
          type: string
          example: ES
        nationality_value:
          type: string
          example: España

    DocumentType:
      type: object
      nullable: false
      required:
        - id
      properties:
        id:
          type: integer
          format: int64
          nullable: false
          description: document type id
          enum:
            - 1
            - 2
            - 3
            - 4
            - 5
        value:
          type: string
          nullable: false
          description: document type value
          enum:
            - NUMERO IDENTIFICACION FISCAL
            - DNI
            - TARJETA RESIDENCIA
            - PASAPORTE
            - CODIGO IDENTIFICACION FISCAL

    UserSector:
      type: object
      required:
        - id
        - value
      nullable: false
      properties:
        id:
          type: integer
          format: int32
          nullable: false
          description: Sector id
          enum:
            - 1
            - 2
            - 3
            - 4
        value:
          type: string
          description: Sector value
          nullable: false
          enum:
            - RESIDENCIAL
            - EMPRESA
            - AUTONOMO
            - HORECA

    UserType:
      type: object
      required:
        - id
        - value
      nullable: false
      properties:
        id:
          type: integer
          format: int64
          nullable: false
          description: User type id
          enum:
            - 1
            - 2
        value:
          type: string
          nullable: false
          description: User type value
          enum:
            - PARTICULAR
            - EMPRESA

    Nationality:
      type: object
      allOf:
        - anyOf:
            - $ref: '#/components/schemas/NationalityId'
            - $ref: '#/components/schemas/NationalityIso'
        - type: object
          description: Value
          properties:
            value:
              type: string
              nullable: false
              description: nationality name
              example: "ESPAÑA"

    NationalityId:
      type: object
      required:
        - id
      nullable: false
      properties:
        id:
          type: integer
          format: int64
          nullable: false
          description: nationality id
          example: 214748364

    NationalityIso:
      type: object
      required:
        - iso
      nullable: false
      properties:
        iso:
          type: string
          nullable: false
          description: nationality iso
          example: ES

    UserAddress:
      type: object
      allOf:
        - anyOf:
            - $ref: '#/components/schemas/UserAddressStateId'
            - $ref: '#/components/schemas/UserAddressStateIso'
        - type: object
          required:
            - zip_code
          nullable: false
          properties:
            address:
              type: string
              nullable: true
              description: Name of the address
              example: "CALLE EMILIO FERRARI"
            state:
              type: string
              nullable: false
              description: Name of the state
              example: "MADRID"
            zip_code:
              type: string
              nullable: false
              description: Zip/Postal code
              example: "28017"
            locality:
              type: string
              nullable: true
              description: Name of the locality
              example: "MADRID"

    UserAddressStateId:
      type: object
      required:
        - state_id
      nullable: false
      properties:
        state_id:
          type: integer
          format: int32
          nullable: false
          description: ID of the state
          example: 214748364

    UserAddressStateIso:
      type: object
      required:
        - state_iso
      nullable: false
      properties:
        state_iso:
          type: string
          nullable: false
          description: ISO of the state
          example: ES-LU

    ErrorMessage:
      type: object
      properties:
        code:
          type: string
          example: "0001"
          description: Custom error code (Zero-padded, e.g. "0001", "0013")
        status:
          type: string
          description: Status
        message:
          type: string
          description: Status message
        detailMsg:
          type: string
          description: Detailed description of the error

    Query:
      type: object
      properties:
        filter:
          type: array
          items:
            type: string
        include:
          type: array
          items:
            type: string

    UserTreeSearch:
      type: object
      oneOf:
        - $ref: '#/components/schemas/UserDocumentSearch'
        - $ref: '#/components/schemas/UserNumberSearch'
        - $ref: '#/components/schemas/UserEmailSearch'


    UserDocumentSearch:
      type: object
      description: document type and value for user search
      required:
        - document_type
        - document
      properties:
        document_type:
          $ref: '#/components/schemas/DocumentTypeSearch'
        document:
          type: string

    UserNumberSearch:
      type: object
      description: user number (MSISDN)
      required:
        - number
      properties:
        number:
          type: string

    UserEmailSearch:
      type: object
      description: user email
      required:
        - email
      properties:
        email:
          type: string

    DocumentTypeSearch:
      type: string
      description: document type value
      enum:
        - NIF
        - DNI
        - TR
        - PASS
        - CIF

    SimReplacement:
      type: object
      required:
        - dealer_id
        - logistic
      properties:
        dealer_id:
          type: string
          description: Dealer ID
        shop_id:
          type: string
          description: Shop ID
        logistic:
          type: boolean
          description: Online/offline operation
        new_icc:
          type: string
          description: New icc

    SimcardInfoResponse:
      type: object
      properties:
        simcard_status_id:
          type: number
          format: int32
          description: Simcard status id
        origin_id:
          type: number
          format: int32
          description: Origin id
        create_date:
          type: string
          format: date
          description: Date of creation
        last_status_date:
          type: string
          format: date
          description: Last status date
        promotion_code:
          type: string
          description: Promotion code
          example: NTH_256
        society_id:
          type: string
          description: Last status date
        initial_balance:
          type: number
          format: double
          description: Initial balance

    PatchAgileTvSubscriptionRequest:
      required:
        - old_email
        - new_email
        - document_number
      properties:
        old_email:
          type: string
          description: "Customer email. Validated in code: max 82 chars, RFC-compatible format, case-insensitive."
          example: old_email@example.com
        new_email:
          type: string
          description: "Customer email. Validated in code: max 82 chars, RFC-compatible format, case-insensitive."
          example: new_email@example.com
        document_number:
          type: string
          example: 11111111A

    ActivateSim:
      type: object
      required:
        - msisdn
      properties:
        msisdn:
          type: string
          pattern: "^[6789]\\d{8}$"
          description: Phone number
        activation_type:
          type: number
          format: int32

    SignupsRequest:
      type: object
      required:
        - sales_type
        - sales_info
        - clients
        - payment
        - products
      properties:
        sales_type:
          type: string
          enum:
            - telecomunications
        sales_info:
          $ref: '#/components/schemas/SalesInfo'
        clients:
          $ref: '#/components/schemas/SignupClients'
        payment:
          $ref: '#/components/schemas/SignupsPayment'
        products:
          $ref: '#/components/schemas/Products'

    Products:
      type: object
      properties:
        mobile_line:
          $ref: '#/components/schemas/MobileLine'
        bundle:
          $ref: '#/components/schemas/SignupsBundle'

    MobileLine:
      type: object
      required:
        - type
        - product_id
        - msisdn
        - wants_communications
      description: Object to signups products of mobile
      properties:
        existing_number:
          description: True if the number already has an active subscription
          type: boolean
          default: false
          example: false
        type:
          description: mobile type is required
          type: string
          enum:
            - mobile
            - main
            - extra
            - additional
          example: mobile
        product_id:
          type: number
          format: int32
          example: 214748364
        portability_info:
          $ref: '#/components/schemas/PortabilityInfo'
        msisdn:
          type: string
          description: Mobile Station International Subscriber Directory Number. In case of portability, it will be the number for portability
        iccid:
          type: string
          description: Integrated Circuit Card ID of the donor operator to signups.
        fabrication_type_sim_id:
          type: integer
          format: int32
          example: 214748364
        initial_balance:
          type: number
          format: double
          description: initial solde for prepaid
        bonuses:
          type: array
          items:
            $ref: '#/components/schemas/Bonuses'
        promotions:
          type: array
          items:
            $ref: '#/components/schemas/SignupsPromotions'
        terminals:
          type: array
          items:
            $ref: '#/components/schemas/Terminal'
        wants_communications:
          type: boolean
          example: true
        expedition_info:
          $ref: '#/components/schemas/ClientExpedition'
        delivery_info:
          description: Delivery info for the device
          $ref: '#/components/schemas/DeliveryInfo'
        devices:
          type: array
          minItems: 1
          maxItems: 1
          items:
            $ref: '#/components/schemas/Device'

    Bonuses:
      type: object
      properties:
        id:
          type: number
          format: int32

    SignupsPromotions:
      type: object
      description: If this object is informed, it´s a promotion. If not, it´s a campaign
      properties:
        id:
          type: number
          format: int32
        value:
          type: string

    Terminal:
      type: object
      required:
        - id
      properties:
        id:
          type: number
          format: int32
        financed:
          type: boolean
        imei:
          type: string
        serial_number:
          type: string

    PortabilityInfo:
      type: object
      required:
        - operator_id
        - operation_type
        - donor_line_type
      properties:
        scheduled_date:
          type: string
          format: date
          example: "2020-04-20"
          description: scheduled date. Format yyyy-MM-dd
        iccid:
          type: string
          description: Integrated Circuit Card ID of the donor operator, required in case it is not postpaid in that operator
        operator_id:
          type: string
          description: id donor operator.
        operation_type:
          type: integer
          format: int32
          enum:
            - 1
            - 2
          description: 1 -> instant, 2 -> scheduled
        initial_date_operation:
          type: string
          format: date
          example: "1999-01-31"
          description: date schedule for start portability.
        donor_line_type:
          type: string
          enum:
            - C
            - P
          description: Line type in actual operator (postpaid or prepaid)
        donor_user:
          $ref: '#/components/schemas/Client'
        internal_portability:
          type: boolean
          nullable: true
        installation_required:
          type: boolean
          nullable: true

    ClientPersonalBase:
      type: object
      allOf:
        - anyOf:
            - $ref: '#/components/schemas/ClientPersonalBaseId'
            - $ref: '#/components/schemas/ClientPersonalBaseIso'
        - type: object
          description: Value
          required:
            - name
            - middlename
            - document_type_id
            - document_value
            - email
            - birthdate
            - contact_phone
            - gender
          properties:
            name:
              type: string
              example: John
            middlename:
              type: string
              example: Nicholas
            lastname:
              type: string
              example: Doe
            document_type_id:
              type: integer
              format: int32
              enum:
                - 1
                - 3
                - 4
                - 5
              example: 1
            document_value:
              type: string
              example: 11111111A
            email:
              type: string
              description: "Customer email. Validated in code: max 82 chars, RFC-compatible format, case-insensitive."
              example: john.doe@example.com
            birthdate:
              type: string
              format: date
              example: "1999-01-31"
            contact_phone:
              type: string
              pattern: "^[6789]\\d{8}$"
            gender:
              type: string
              description: Male or female
              enum:
                - M
                - F

    ClientPersonalBaseId:
      type: object
      description: required if sector is not business
      required:
        - language_id
        - nationality_id
      properties:
        language_id:
          type: number
          format: int32
          example: 214748364
        nationality_id:
          type: number
          format: int32
          example: 214748364

    ClientPersonalBaseIso:
      type: object
      required:
        - nationality_iso
        - language_iso
      description: required if sector is not business
      properties:
        nationality_iso:
          type: string
          example: "ES"
        language_iso:
          type: string
          example: "es"

    ClientBusinessBase:
      type: object
      required:
        - company_name
        - document_type_id
      description: required if sector is business
      properties:
        company_name:
          type: string
          example: Pole Group Recordings
        document_type_id:
          type: integer
          format: int32
          enum:
            - 1
            - 3
            - 4
            - 5
          example: 1
        document_value:
          type: string
          example: "11111111A"

    SignupsBundle:
      type: object
      description: Object to signups for bundle products
      required:
        - bundle_id
        - delivery_info
      properties:
        bundle_id:
          type: number
          format: int32
          description: identification bundle
        territory_owner:
          description: Territory owner. Only required in broadband signups
          type: string
        promotions:
          type: array
          items:
            $ref: '#/components/schemas/SignupsPromotions'
        installation_info:
          $ref: '#/components/schemas/InstallationInfo'
        delivery_info:
          $ref: '#/components/schemas/DeliveryInfo'
        landline:
          $ref: '#/components/schemas/Landline'
        ftth:
          $ref: '#/components/schemas/Ftth'
        adsl:
          $ref: '#/components/schemas/Adsl'
        mobile_lines:
          type: array
          items:
            $ref: '#/components/schemas/MobileLine'
        tv:
          $ref: '#/components/schemas/Tv'
        ott:
          type: array
          items:
            $ref: '#/components/schemas/Ott'

    InstallationInfo:
      type: object
      description: Installation info. Only required for broadband signups
      required:
        - contact
        - address
      properties:
        contact:
          $ref: '#/components/schemas/Contact'
        address:
          $ref: '#/components/schemas/InstallationAddress'

    DeliveryInfo:
      type: object
      required:
        - contact
        - address
      additionalProperties: false
      properties:
        contact:
          $ref: '#/components/schemas/Contact'
        address:
          $ref: '#/components/schemas/DeliveryAddress'
        delivery_shop_id:
          type: string
          description: Shop identifier where the pickup (if that's the case) will occur
          example: "0025"
          maxLength: 50
          nullable: true
        delivery_type:
          type: string
          description: how a device will be delivered to a customer
          enum:
            - LOGISTIC
            - IN_PERSON
            - STORE_DELIVERY
          nullable: true

    ExpeditionInfo:
      allOf:
        - $ref: '#/components/schemas/ClientExpedition'
        - type: object
          #additionalProperties: false
          properties:
            delivery_shop_id:
              type: string
              description: Shop identifier where the pickup (if that's the case) will occur
              example: "0025"
              maxLength: 50
              nullable: true
            delivery_type:
              type: string
              description: how a device will be delivered to a customer
              enum:
                - LOGISTIC
                - IN_PERSON
                - STORE_DELIVERY
              nullable: true


    Contact:
      type: object
      required:
        - name
        - phone
        - email
        - document_type_id
        - document_value
      properties:
        name:
          type: string
        middlename:
          type: string
          nullable: true
        lastname:
          type: string
          nullable: true
        phone:
          type: string
        email:
          type: string
          description: "Customer email. Validated in code: max 82 chars, RFC-compatible format, case-insensitive."
        document_type_id:
          type: number
          format: int32
        document_value:
          type: string

    NormalizedAddress:
      type: object
      required:
        - street_type_id
        - street_name
        - number
        - state_id
        - locality
        - postal_code
      properties:
        street_type_id:
          type: number
          format: int32
        street_name:
          type: string
        number:
          type: string
        supplement:
          type: string
        state_id:
          type: number
          format: int32
        locality:
          type: string
        postal_code:
          type: string

    InstallationAddress:
      allOf:
        - $ref: '#/components/schemas/NormalizedAddress'
        - type: object
          required:
            - gescal
            - pair_vacancy
            - address_id
          properties:
            gescal:
              type: string
              minLength: 17
              maxLength: 37
            pair_vacancy:
              type: boolean
            address_id:
              type: string

    DeliveryAddress:
      allOf:
        - $ref: '#/components/schemas/NormalizedAddress'
        - type: object
          properties:
            observation:
              type: string

    Ftth:
      type: object
      required:
        - product_id
        - wants_communications
      properties:
        product_id:
          type: number
          format: int32
        promotions:
          type: array
          items:
            $ref: '#/components/schemas/SignupsPromotions'
        connection_type:
          type: string
        installer:
          type: string
        iua:
          type: string
        terminals:
          type: array
          items:
            $ref: '#/components/schemas/Terminal'
        wants_communications:
          type: boolean
        access_reuse:
          type: string
          description: Current possible values are 'Interno' and 'Orange'.
          example: "Interno"
          nullable: true
        access_reuse_choice:
          type: boolean
          description: Client consents for ftth origin access. For portabilities is not mandatory. If it is not informed, it will be considered as null. Otherwise is mandatory to inform it.
          nullable: true
        services:
          type: array
          items:
            $ref: '#/components/schemas/SignupsServices'
    Adsl:
      type: object
      required:
        - product_id
        - wants_communications
        - install_tech_support
        - tech_support_billiable
      properties:
        product_id:
          type: number
          format: int32
        promotions:
          type: array
          items:
            $ref: '#/components/schemas/SignupsPromotions'
        wants_communications:
          type: boolean
        install_tech_support:
          type: boolean
        tech_support_billiable:
          type: boolean

    Landline:
      type: object
      required:
        - product_id
        - number
        - wants_communications
      properties:
        product_id:
          type: number
          format: int32
        portability_info:
          $ref: '#/components/schemas/PortabilityInfo'
        number:
          type: string
          pattern: "^[6789]\\d{8}$"
        bonuses:
          type: array
          items:
            $ref: '#/components/schemas/Bonuses'
        promotions:
          type: array
          items:
            $ref: '#/components/schemas/SignupsPromotions'
        services:
          type: array
          items:
            $ref: '#/components/schemas/SignupsServices'
        wants_communications:
          type: boolean

    SignupsServices:
      type: object
      required:
        - id
      properties:
        id:
          type: number
          format: int32

    Tv:
      type: object
      required:
        - product_id
        - number_associated
        - registration_email
        - contact_phone
        - install_tech_support
      properties:
        product_id:
          type: number
          format: int32
        number_associated:
          type: string
        registration_email:
          type: string
          description: "Customer email. Validated in code: max 82 chars, RFC-compatible format, case-insensitive."
        contact_phone:
          type: string
        install_tech_support:
          type: boolean
        promotions:
          type: array
          items:
            $ref: '#/components/schemas/SignupsPromotions'
        terminals:
          type: array
          items:
            $ref: '#/components/schemas/Terminal'

    Ott:
      type: object
      required:
        - product_id
      properties:
        product_id:
          type: number
          format: int32
        email:
          type: string
          description: "Customer email. Validated in code: max 82 chars, RFC-compatible format, case-insensitive."
        promotions:
          type: array
          items:
            $ref: '#/components/schemas/SignupsPromotions'

    SignupsPayment:
      type: object
      properties:
        billing_type_id:
          type: integer
          format: int32
          enum:
            - 1
            - 2
            - 3
        scoring:
          $ref: '#/components/schemas/SignupsScoring'
        info:
          $ref: '#/components/schemas/SignupsPaymentInfo'
        tpv_response:
          $ref: '#/components/schemas/SignupsTpvResponse'
        account_number:
          type: string
          description: Existing account number. Do not fill when doing signups. Fill this field only when doing addSubscriptionToAccount endpoint.

    SignupsPaymentInfo:
      type: object
      properties:
        bank_account:
          type: string
          pattern: '^[0-9]{20}$'
        swift_bic:
          type: string

    SignupsTpvResponse:
      type: object
      required:
        - amount
        - card_number
        - expiry_date
      properties:
        amount:
          type: string
        card_number:
          type: string
          example: "000000******0000"
        expiry_date:
          type: string
          example: "0121"
        transaction_id:
          type: string
          example: "1563B44RPR2"
          nullable: true
        reference_id:
          type: string
          nullable: true
        platform:
          type: string
          enum:
            - PAYMENTS
            - ADYEN
            - REDSYS
        payment_link:
          type: string
          nullable: true
          maxLength: 50
        tax:
          type: number
          format: double
          minimum: 0.0
          maximum: 99.9
          nullable: true
          example: 21.0
          description: If not sent, 21.0 will apply

    SignupsScoring:
      type: object
      required:
        - scoring_value
        - id_value
        - forced_value
        - up_front
      properties:
        scoring_value:
          type: number
          format: int64
        id_value:
          type: number
          format: int64
        forced_value:
          type: number
          format: int32
        up_front:
          type: number
          format: double
        credit_limit:
          type: number
          format: double
          nullable: true
        credit_limit_available:
          description: This value should be calculated by you. The service does not calculate the value.
          type: number
          format: double
          nullable: true
        app_id:
          type: number
          format: int64
          nullable: true

    SignupClients:
      type: object
      required:
        - sector_id
        - attributes
      properties:
        sector_id:
          type: integer
          format: int32
          enum:
            - 1
            - 2
            - 3
            - 4
        attributes:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/SignupClient'

    Client:
      type: object
      description: User with "client" type is used if donor_user is not present
      oneOf:
        - $ref: '#/components/schemas/ExistingClient'
        - $ref: '#/components/schemas/ClientPersonal'
        - $ref: '#/components/schemas/ClientBusiness'

    SignupClient:
      type: object
      oneOf:
        - $ref: '#/components/schemas/SignupExistingClient'
        - $ref: '#/components/schemas/SignupClientPersonal'
        - $ref: '#/components/schemas/SignupClientBusiness'

    ClientBusiness:
      allOf:
        - $ref: '#/components/schemas/ClientBusinessBase'
        - type: object
          required:
            - type
            - address
            - nationality_id
            - language_id
          description: required if sector is business
          properties:
            type:
              description: client type is required
              type: string
              enum:
                - client
                - account
                - send
              example: client
            nationality_id:
              type: number
              format: int32
              example: 214748364
            language_id:
              type: number
              format: int32
              example: 214748364
            email:
              type: string
              description: "Customer email. Validated in code: max 82 chars, RFC-compatible format, case-insensitive."
              example: john.doe@example.com
            contact_phone:
              type: string
              pattern: "^[6789]\\d{8}$"
            address:
              $ref: '#/components/schemas/ClientAddress'
            responsable:
              $ref: '#/components/schemas/ClientBusinessResponsable'

    SignupClientBusiness:
      allOf:
        - $ref: '#/components/schemas/ClientBusiness'
        - type: object
          properties:
            responsable:
              $ref: '#/components/schemas/SignupClientBusinessResponsable'

    SignupClientBusinessResponsable:
      allOf:
        - $ref: '#/components/schemas/ClientBusinessResponsable'
        - type: object
          properties:
            document_expiration_date:
              type: string
              format: date
              example: "1999-01-31"
            employment:
              $ref: '#/components/schemas/Employment'

    ClientPersonal:
      allOf:
        - $ref: '#/components/schemas/ClientPersonalBase'
        - type: object
          required:
            - type
            - address
            - gender
          description: required if sector is not business
          properties:
            type:
              type: string
              description: account -> Payment and contract holder. if it is not indicated, by default it takes client data<br>send -> Shipping holder. if it is not indicated, by default it takes client data
              enum:
                - client
                - account
                - send
              example: client
            address:
              $ref: '#/components/schemas/ClientAddress'

    SignupClientPersonal:
      allOf:
        - $ref: '#/components/schemas/ClientPersonal'
        - type: object
          properties:
            document_expiration_date:
              type: string
              format: date
              example: "1999-01-31"
            employment:
              $ref: '#/components/schemas/Employment'

    ClientAddress:
      type: object
      allOf:
        - anyOf:
            - $ref: '#/components/schemas/ClientAddressId'
            - $ref: '#/components/schemas/ClientAddressIso'
        - type: object
          description: Value
          properties:
            value:
              type: string
              nullable: false
              description: language value
              example: Castellano
              enum:
                - Castellano
                - Catalan
                - Galego
                - Vasco
                - Ingles
                - Portugues

    ClientAddressId:
      type: object
      description: client address
      required:
        - state_id
      properties:
        street_name:
          type: string
        state_id:
          type: number
          format: int32
        locality:
          type: string
        postal_code:
          type: string
        country:
          type: string
        number:
          type: string
          nullable: true

    ClientAddressIso:
      type: object
      description: client address
      required:
        - state_iso
      properties:
        street_name:
          type: string
        state_iso:
          type: string
        locality:
          type: string
        postal_code:
          type: string
        country:
          type: string
        number:
          type: string
          nullable: true

    ClientExpedition:
      type: object
      description: Information needed by logistics to send SIM cards
      allOf:
        - oneOf:
            - $ref: '#/components/schemas/ClientPersonalBase'
            - type: object
              allOf:
                - $ref: '#/components/schemas/ClientBusinessBase'
                - type: object
                  properties:
                    responsable:
                      $ref: '#/components/schemas/ClientBusinessResponsable'
        - type: object
          description: Location
          properties:
            address:
              $ref: '#/components/schemas/ClientAddress'

    ClientBusinessResponsable:
      type: object
      description: Person assigned as responsable of the company
      required:
        - name
        - middlename
        - lastname
        - document_type_id
        - document_value
        - nationality_id
      properties:
        name:
          type: string
          example: John
        middlename:
          type: string
          example: Nicholas
        lastname:
          type: string
          example: Doe
        document_type_id:
          type: integer
          format: int32
          enum:
            - 1
            - 3
            - 4
            - 5
          example: 1
        document_value:
          type: string
          example: 11111111A
        nationality_id:
          type: number
          format: int32
          example: 214748364

    SalesInfo:
      type: object
      required:
        - dealer_id
        - logistic
      properties:
        channel:
          type: string
          enum:
            - dealer
            - call_center
          deprecated: true
        dealer_id:
          type: string
        shop_id:
          type: string
        agent_id:
          type: string
        logistic:
          type: boolean
          example: true
        signature_process_id:
          type: number
          format: int64
        signature_type:
          $ref: '#/components/schemas/SignatureType'
        channel_id:
          type: number
          format: int64
          nullable: true

    SignupsResponse:
      type: object
      properties:
        sell_id:
          type: number
          format: int64
        customer_id:
          type: number
          format: int64
        work_order_id:
          type: string
          example: "FOO_XYZ"
          description: identification work order
        account_info:
          $ref: '#/components/schemas/AccountInfoResponse'
        risk_decision:
          type: string

    AddLineToBundleResponse:
      type: object
      properties:
        risk_decision:
          type: string

    BundleMigrationResponse:
      type: object
      properties:
        risk_decision:
          type: string

    AccountInfoResponse:
      type: object
      properties:
        account_id:
          type: number
          format: int64
        account_number:
          type: string
        bundle_id:
          type: integer
          format: int64
        subscriptions:
          type: array
          items:
            $ref: '#/components/schemas/SubscriptionResponse'

    SubscriptionResponse:
      type: object
      required:
        - type
        - subscription_id
        - user_info_id
      properties:
        type:
          type: number
          format: int32
          description: tipos de suscripción:<br> <ul><li>2 postpago mobile</li><li>4 digital</li><li>5 adsl</li><li>6 ftth</li><li>7 TV</li></ul>
        subscription_id:
          type: number
          format: int64
        user_info_id:
          type: number
          format: int64
        msisdn:
          type: string
        fixed_number:
          type: string
        associated_number:
          type: string
        subscription_terminal_id:
          type: number
          format: int64

    SignupsMasterData:
      type: object
      properties:
        states:
          type: array
          items:
            $ref: '#/components/schemas/States'
        document_types:
          type: array
          items:
            $ref: '#/components/schemas/SignupsDocumentType'
        nationalities:
          type: array
          items:
            $ref: '#/components/schemas/Nationalities'
        languages:
          type: array
          items:
            $ref: '#/components/schemas/Languages'
        balances:
          type: array
          items:
            type: number
            format: double
        mobile_operators:
          type: array
          items:
            $ref: '#/components/schemas/Operator'
        cli_operators:
          type: array
          items:
            $ref: '#/components/schemas/Operator'
        sectors:
          type: array
          items:
            $ref: '#/components/schemas/Sector'
        billing_types:
          type: array
          items:
            $ref: '#/components/schemas/BillingType'
        fabrication_types:
          type: array
          items:
            $ref: '#/components/schemas/FabricationType'
        deactivation_motives:
          $ref: '#/components/schemas/DeactivationMotives'
        movement_types:
          type: array
          items:
            $ref: '#/components/schemas/MovementType'
        recharge_origins:
          type: array
          items:
            $ref: '#/components/schemas/RechargeOrigin'
        occupations:
          type: array
          items:
            $ref: '#/components/schemas/Occupations'
        occupation_sectors:
          type: array
          items:
            $ref: '#/components/schemas/OccupationSectors'

    Occupations:
      type: object
      properties:
        id:
          type: number
          format: int32
        value:
          type: string
          example: "Empresario"

    OccupationSectors:
      type: object
      properties:
        id:
          type: number
          format: int32
        value:
          type: string
          example: "Armas y energía nuclear"

    States:
      type: object
      properties:
        id:
          type: number
          format: int32
        value:
          type: string
          example: "Lugo"
        iso:
          type: string
          example: "ES-LU"

    Nationalities:
      type: object
      properties:
        id:
          type: number
          format: int32
        value:
          type: string
          example: "España"
        iso:
          type: string
          example: "ES"
    Languages:
      type: object
      properties:
        id:
          type: number
          format: int32
        value:
          type: string
          example: "Castellano"
        iso:
          type: string
          example: "es"

    SignupsDocumentType:
      type: object
      properties:
        id:
          type: number
          format: int32
        value:
          type: string
          example: "nif"
        description:
          type: string
          example: ""

    Operator:
      type: object
      properties:
        code:
          type: string
        name:
          type: string

    FabricationType:
      type: object
      properties:
        id:
          type: number
          format: int32
        value:
          type: string

    Sector:
      type: object
      properties:
        id:
          type: number
          format: int32
        value:
          type: string
          example: "RESIDENCIAL"

    AvailableMsisdns:
      type: object
      properties:
        host_cfg_id:
          type: number
          format: int32
          description: this endpoint only support YOIGO network
        available_msisdns:
          type: array
          items:
            type: string

    DeactivationMotives:
      type: object
      properties:
        termination_motives:
          type: array
          items:
            $ref: '#/components/schemas/TerminationMotive'
        cancellation_motives:
          type: array
          items:
            $ref: '#/components/schemas/CancellationMotive'

    TerminationMotive:
      type: object
      properties:
        id:
          type: number
          format: int32
          example: 214748364
        value:
          type: string
          example: "LOGISTICA"

    CancellationMotive:
      type: object
      properties:
        id:
          type: number
          format: int32
          example: 214748364
        value:
          type: string
          example: "CONTRAOFERTA"

    AddLineToBundleRequest:
      type: object
      required:
        - account
      properties:
        client:
          $ref: '#/components/schemas/AddLineToBundleClient'
        sales_info:
          $ref: '#/components/schemas/SalesInfo'
        account:
          $ref: '#/components/schemas/AddLineToBundleAccount'
        tpv_response:
          $ref: '#/components/schemas/SignupsTpvResponse'
          nullable: true

    AddLineToBundleClient:
      type: object
      properties:
        attributes:
          $ref: '#/components/schemas/AddLineToBundleClientAttributes'

    AddLineToBundleClientAttributes:
      type: object
      properties:
        document_expiration_date:
          type: string
          format: date
          example: "1999-01-31"
        employment:
          $ref: '#/components/schemas/Employment'

    AddLineToBundleAccount:
      type: object
      required:
        - account_id
        - subscriptions
      properties:
        account_id:
          type: integer
          format: int32
          description: Account ID
        subscriptions:
          $ref: '#/components/schemas/AddLineToBundleSubscriptions'

    AddLineToBundleSubscriptions:
      type: object
      properties:
        mobile_lines:
          type: array
          items:
            $ref: '#/components/schemas/AddLineToBundleMobileLine'
          description: Mobile lines subscriptions
        tv:
          $ref: '#/components/schemas/BundleChangesTv'

    BundleMigrationRequest:
      type: object
      required:
        - account
      properties:
        client:
          $ref: '#/components/schemas/BundleMigrationClient'
        sales_info:
          $ref: '#/components/schemas/BundleMigrationSalesInfo'
        account:
          $ref: '#/components/schemas/BundleMigrationAccount'

    BundleMigrationClient:
      type: object
      properties:
        attributes:
          $ref: '#/components/schemas/BundleMigrationClientAttributes'

    BundleMigrationClientAttributes:
      type: object
      properties:
        document_expiration_date:
          type: string
          format: date
          example: "1999-01-31"
        employment:
          $ref: '#/components/schemas/Employment'

    BundleMigrationAccount:
      type: object
      required:
        - new_bundle_id
        - account_id
      properties:
        new_bundle_id:
          type: integer
          format: int32
          description: New bundle id to migrate to
        account_id:
          type: integer
          format: int32
          description: Account ID
        territory_owner:
          type: string
        subscriptions:
          $ref: '#/components/schemas/BundleMigrationSubscriptions'
        promotions:
          type: array
          items:
            $ref: '#/components/schemas/SignupsPromotions'

    BundleMigrationSubscriptions:
      type: object
      properties:
        mobile_lines:
          type: array
          items:
            $ref: '#/components/schemas/BundleMigrationMobileLine'
        tv:
          $ref: '#/components/schemas/BundleChangesTv'
        ftth:
          $ref: '#/components/schemas/BundleChangesFtth'
        adsl:
          $ref: '#/components/schemas/BundleChangesAdsl'
        ott:
          type: array
          items:
            $ref: '#/components/schemas/BundleChangesOtt'

    BundleChangesOtt:
      type: object
      required:
        - product_id
      properties:
        product_id:
          type: number
          format: int32
        email:
          type: string
          description: "Customer email. Validated in code: max 82 chars, RFC-compatible format, case-insensitive."
        promotions:
          type: array
          items:
            $ref: '#/components/schemas/SignupsPromotions'

    AddLineToBundleMobileLine:
      type: object
      required:
        - type
        - product_id
        - msisdn
      properties:
        type:
          description: Type of mobile line
          type: string
          enum:
            - extra
            - additional
          example: additional
        product_id:
          type: integer
          format: int32
          description: Destination product ID
        msisdn:
          type: string
          pattern: "^[6789]\\d{8}$"
          description: Mobile Station International Subscriber Directory Number
          example: 12345
        iccid:
          type: string
          description: New Integrated Circuit Card ID
          example: "8934042419120320845"
        fabrication_type_sim_id:
          type: integer
          format: int32
          description: Fabrication type, according to data returned from master-data
          example: 214748364
        portability_info:
          $ref: '#/components/schemas/BundleChangesPortabilityInfo'
        bonuses:
          type: array
          items:
            $ref: '#/components/schemas/Bonuses'
          description: Bonuses added to subscription
        promotions:
          type: array
          items:
            $ref: '#/components/schemas/SignupsPromotions'
          description: Promotions added to subscription
        terminals:
          type: array
          items:
            $ref: '#/components/schemas/Terminal'
          description: Terminals purchased along with subscription
        devices:
          type: array
          minItems: 1
          maxItems: 1
          items:
            $ref: '#/components/schemas/Device'
        expedition_info:
          $ref: '#/components/schemas/ExpeditionInfo'

    BundleChangesPortabilityInfo:
      type: object
      required:
        - operator_id
        - operation_type
        - donor_line_type
      properties:
        iccid:
          type: string
          description: Integrated Circuit Card ID of the donor operator
          example: "8934042419120320845"
        operator_id:
          type: string
          description: Donor operator ID
          example: 214748364
        operation_type:
          type: integer
          format: int32
          enum:
            - 1
          description: 1 -> instantaneous
        initial_date_operation:
          type: string
          format: date
          example: "1999-01-31"
          description: date schedule for start portability.
        donor_line_type:
          type: string
          enum:
            - C
            - P
          description: Line type in current operator (postpaid or prepaid)
        internal_portability:
          type: boolean
          nullable: true
        installation_required:
          type: boolean
          nullable: true
        donor_user:
          $ref: '#/components/schemas/Client'

    BundleChangesTv:
      type: object
      required:
        - product_id
        - number_associated
        - contact_phone
        - terminals
      properties:
        product_id:
          type: integer
          format: int32
          description: Product ID
        number_associated:
          type: string
          pattern: "^[6789]\\d{8}$"
          description: Number associated to TV subscription
          example: 12345
        registration_email:
          type: string
          description: "Customer email. Validated in code: max 82 chars, RFC-compatible format, case-insensitive."
        contact_phone:
          type: string
          pattern: "^[6789]\\d{8}$"
          description: Contact phone
          example: 12345
        promotions:
          type: array
          items:
            $ref: '#/components/schemas/SignupsPromotions'
          description: Promotions associated to TV subscription
        terminals:
          type: array
          items:
            $ref: '#/components/schemas/Terminal'
          description: Terminals purchased along with TV subscription

    BundleMigrationMobileLine:
      type: object
      required:
        - type
        - product_id
        - msisdn
      properties:
        subscription_id:
          type: integer
          format: int64
          description: Active mobile line subscription id
        type:
          description: Type of mobile line
          type: string
          enum:
            - main
            - extra
            - additional
          example: additional
        product_id:
          type: integer
          format: int32
          description: Destination product ID
        msisdn:
          type: string
          pattern: "^[6789]\\d{8}$"
          description: Mobile Station International Subscriber Directory Number
          example: 12345
        iccid:
          type: string
          description: New Integrated Circuit Card ID
          example: "8934042419120320845"
        fabrication_type_sim_id:
          type: integer
          format: int32
          description: Fabrication type, according to data returned from master-data
          example: 214748364
        portability_info:
          $ref: '#/components/schemas/BundleChangesPortabilityInfo'
        bonuses:
          type: array
          items:
            $ref: '#/components/schemas/Bonuses'
          description: Bonuses added to subscription
        promotions:
          type: array
          items:
            $ref: '#/components/schemas/SignupsPromotions'
          description: Promotions added to subscription
        terminals:
          type: array
          items:
            $ref: '#/components/schemas/Terminal'
          description: Terminals purchased along with subscription
        devices:
          type: array
          minItems: 1
          maxItems: 1
          items:
            $ref: '#/components/schemas/Device'

    BundleChangesFtth:
      type: object
      required:
        - product_id
      properties:
        product_id:
          type: number
          format: int32
        promotions:
          type: array
          items:
            $ref: '#/components/schemas/SignupsPromotions'
        terminals:
          type: array
          items:
            $ref: '#/components/schemas/Terminal'

    BundleChangesAdsl:
      type: object
      required:
        - product_id
      properties:
        product_id:
          type: number
          format: int32
        promotions:
          type: array
          items:
            $ref: '#/components/schemas/SignupsPromotions'
        terminals:
          type: array
          items:
            $ref: '#/components/schemas/Terminal'

    BundleMigrationSalesInfo:
      type: object
      required:
        - logistic
      properties:
        shop_id:
          type: string
        logistic:
          type: boolean
          example: true
        signature_process_id:
          type: number
          format: int64

    ExistingClient:
      type: object
      required:
        - type
        - document_type_id
        - document_value
      properties:
        type:
          type: string
          description: Field is only available with the following values to avoid confusion with ClientPersonal and ClientBusiness
          enum:
            - existing
        document_type_id:
          type: integer
          format: int32
          enum:
            - 1
            - 3
            - 4
            - 5
          example: 1
        document_value:
          type: string
          example: 11111111A
      additionalProperties: false

    SignupExistingClient:
      allOf:
        - $ref: '#/components/schemas/ExistingClient'
        - type: object
          properties:
            document_expiration_date:
              type: string
              format: date
              example: "1999-01-31"
            employment:
              $ref: '#/components/schemas/Employment'


    ComputedPenalties:
      type: array
      items:
        $ref: '#/components/schemas/ComputedPenalty'

    ComputedPenalty:
      type: object
      properties:
        computed_penalty_id:
          type: number
        mobile_operator_id:
          type: number
        penalties:
          type: array
          items:
            $ref: '#/components/schemas/Penalty'

    Penalty:
      type: object
      properties:
        id:
          type: integer
          format: int64
        value:
          type: number
        description:
          type: string
        subscription_id:
          type: integer
          format: int64
        subscription_uuid:
          type: string
          format: uuid
        commitment_uuid:
          type: string
          format: uuid
        subscrition_promotion_id:
          type: integer
          format: int64
        promotion_id:
          type: integer
          format: int64
        start_date:
          type: string
          format: date
          example: "1999-01-31"
        end_date:
          type: string
          format: date
          example: "1999-01-31"
        mandatory:
          type: boolean
        type:
          type: string
          example: "ADMCOSTCANCELCOST"
        subscription_terminal_id:
          type: integer
          format: int64

    AccountPenaltiesReason:
      type: string
      enum:
        - unsubscribe
        - cancel

    SubscriptionPenaltiesReason:
      type: string
      enum:
        - broadband_subscription
        - device
        - mobile

    AddDeviceToSubscriptionRequest:
      type: object
      required:
        - sell
        - client
        - device
        - subscription_offer_segment
      additionalProperties: false
      properties:
        delivery_info:
          $ref: '#/components/schemas/DeviceDeliveryInfo'
        sell:
          $ref: '#/components/schemas/Sell'
        client:
          $ref: '#/components/schemas/DeviceClient'
        device:
          $ref: '#/components/schemas/SubscriptionDevice'
        subscription_offer_segment:
          type: string
          nullable: false

    DeviceDeliveryInfo:
      type: object
      required:
        - contact
        - address
      additionalProperties: false
      properties:
        shipping_price:
          type: number
          format: double
          minimum: 0.0
          maximum: 999999999.99
        pay_in_return:
          type: boolean
        contact:
          $ref: '#/components/schemas/DeviceContact'
        address:
          $ref: '#/components/schemas/DeviceNormalizedAddress'
        delivery_shop_id:
          type: string
          description: Shop identifier where the pickup (if that's the case) will occur
          example: "0025"
          maxLength: 50
          nullable: true
        delivery_type:
          type: string
          description: how a device will be delivered to a customer
          enum:
            - LOGISTIC
            - IN_PERSON
            - STORE_DELIVERY
          nullable: true

    DeviceContact:
      type: object
      required:
        - name
        - phone
      additionalProperties: false
      properties:
        name:
          type: string
        phone:
          type: string

    DeviceNormalizedAddress:
      type: object
      required:
        - street_type
        - street_name
        - number
        - town
        - province_id
        - postal_code
      additionalProperties: false
      properties:
        address_id:
          type: string
          maxLength: 50
          deprecated: true
        description:
          type: string
          maxLength: 150
          deprecated: true
        street_type:
          type: string
          title: street_type
          description: Street type, default value is UNKNOWN
          default: UNKNOWN
          enum:
            - ACCESS
            - AVENUE
            - BOULEVARD
            - BUILDING
            - COLONY
            - COMPLEX
            - CORE
            - COURTYARD
            - CROSSING
            - DISSEMINATED
            - DITCH
            - ENTRY
            - EXTENSION
            - FARM_HOUSE
            - FARMHOUSE
            - GROUP
            - GROUPING
            - HALLWAY
            - HIGHWAY
            - HOUSE
            - ITEM
            - NEIGHBORHOOD
            - OUTSKIRT
            - PARK
            - PARCEL
            - PASSAGE
            - PLACE
            - POLYGON
            - RAVINE
            - RESIDENCE
            - ROAD
            - ROUND
            - ROUNDABOUT
            - SET
            - SIDE_STREET
            - SIDEWALK
            - SLOPE
            - SLUM
            - SMALL_SQUARE
            - SQUARE
            - STREET
            - SUBURB
            - TOWN
            - TRAIL
            - UNKNOWN
            - URBANIZATION
            - VIA
            - WAY
            - ZONE
        street_name:
          type: string
          maxLength: 100
        number:
          type: string
          maxLength: 50
        block:
          type: string
          maxLength: 10
          deprecated: true
        bis:
          type: string
          maxLength: 3
          deprecated: true
        floor:
          type: string
          maxLength: 25
        stair:
          type: string
          maxLength: 15
          deprecated: true
        door:
          type: string
          maxLength: 15
        letter:
          type: string
          maxLength: 10
          deprecated: true
        hand1:
          type: string
          maxLength: 12
          deprecated: true
        hand2:
          type: string
          maxLength: 12
          deprecated: true
        postal_code:
          type: string
          maxLength: 10
        town:
          type: string
          maxLength: 100
        province_id:
          type: string
          maxLength: 2
          description: Numeric province id from 01 to 52
          example: "28"
        technical_id:
          type: string
          description: Gescal 37
          maxLength: 37
          deprecated: true

    Sell:
      type: object
      additionalProperties: false
      required:
        - category
      properties:
        dealer_id:
          type: string
          description: Dealer id
          example: "C00002"
          maxLength: 50
        shop_id:
          type: string
          description: Shop id
          example: "0025"
          maxLength: 50
        channel_id:
          type: integer
        category:
          type: string
          nullable: false
          description: Role of the sale
          enum:
            - Generic
            - Loyalty
            - Retention
        payment:
          $ref: '#/components/schemas/SellPayment'

    SellPayment:
      type: object
      additionalProperties: false
      properties:
        id:
          type: number
          format: int64
          minimum: 0
          maximum: 999999999
        credit_card_reference:
          type: string
          maxLength: 50
        transaction_id:
          type: string
          example: "9651BHUZ2A3"
          maxLength: 50
        reference_id:
          type: string
          maxLength: 50
        scoring:
          nullable: true
          $ref: '#/components/schemas/SignupsScoring'
        platform:
          type: string
          enum:
            - PAYMENTS
            - ADYEN
            - REDSYS
        payment_link:
          type: string
          nullable: true
          maxLength: 50
        tax:
          type: number
          format: double
          minimum: 0.0
          maximum: 99.9
          nullable: true
          example: 21.0
          description: If not sent, 21.0 will apply

    DeviceClient:
      type: object
      additionalProperties: false
      properties:
        customer_id:
          type: string
        account_id:
          type: string
          maxLength: 10
        attributes:
          type: object
          additionalProperties: false
          properties:
            document_expiration_date:
              type: string
              format: date
              example: "1999-01-31"
            employment:
              $ref: '#/components/schemas/Employment'

    Employment:
      type: object
      deprecated: true
      additionalProperties: false
      properties:
        activity_country_code:
          type: string
          maxLength: 2
        company:
          type: string
          maxLength: 100
        income:
          type: number
          format: double
          minimum: 0.00
          maximum: 9999999999999.99
        income_source:
          type: object
          deprecated: true
          additionalProperties: false
          properties:
            id:
              type: integer
              minimum: 0
              maximum: 999999999
            observations:
              type: string
              maxLength: 100
        profession:
          type: integer
          minimum: 0
          maximum: 999999999
        professional_area:
          type: integer
          minimum: 0
          maximum: 999999999
        professional_use:
          type: boolean

    Device:
      type: object
      required:
        - device_details
        - fees
        - reservation_id
      additionalProperties: false
      properties:
        device_details:
          type: object
          required:
            - id
            - model_id
          additionalProperties: false
          properties:
            id:
              type: integer
              description: Catalogue instance id
            model_id:
              type: string
              minLength: 1
              description: Catalogue device id
            cession_price:
              type: number
              format: double
              minimum: 0.00
              maximum: 999999999.99
            imei:
              type: string
              maxLength: 50
            pending_imei:
              type: boolean
            insured_amount:
              type: number
              format: double
              minimum: 0.01
              maximum: 999999999.99
              nullable: true
            category:
              type: string
              nullable: true
            logistic_required:
              type: boolean
              nullable: true
            catalogue_id:
              type: string
              maxLength: 255
              nullable: true
            amount:
              type: number
              format: double
              minimum: 0.01
              maximum: 999999999.99
              nullable: true
        fees:
          $ref: '#/components/schemas/DeviceFees'
        financial_details:
          $ref: '#/components/schemas/FinancialDetails'
        campaign_id:
          type: integer
        terms:
          $ref: '#/components/schemas/Terms'
        reservation_id:
          type: string
        signature_process_id:
          type: number
          format: int64
        signature_type:
          $ref: '#/components/schemas/SignatureType'
        old_subscription_terminal_id:
          type: integer
          format: int64
          nullable: true

    AddDeviceToSubscriptionResponse:
      type: object
      additionalProperties: false
      properties:
        risk_decision:
          type: string
        subscription_terminal_id:
          type: number
          format: int64

    ChangeSubscriptionProductResponse:
      type: object
      additionalProperties: false
      properties:
        risk_decision:
          type: string

    SimReplacementResponse:
      type: object
      additionalProperties: false
      properties:
        risk_decision:
          type: string

    GetAccountContractsResponse:
      type: object
      additionalProperties: false
      properties:
        contracts:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              account_bundle_id:
                type: integer
                format: int64
                example: 214748364
              account_id:
                type: integer
                format: int64
              pdf_file_name:
                type: string
              document_id:
                type: string
              digital_signature_origin_id:
                type: string
              ineid:
                type: string
              iccid:
                type: string
              ccggid:
                type: string
              subscription_id:
                type: integer
                format: int64
                example: 214748364
              subscription_terminal_id:
                type: integer
                format: int64
                example: 214748364
              process_id:
                type: string
              status:
                type: string
              signed_document_id:
                type: string
              contract_id:
                type: string
                format: uuid

    SubscriptionDevice:
      type: object
      required:
        - device_details
        - fees
        - reservation_id
      additionalProperties: false
      properties:
        device_details:
          type: object
          required:
            - id
            - model_id
            - catalogue_id
          additionalProperties: false
          properties:
            id:
              type: integer
              description: Catalogue instance id
            model_id:
              type: string
              minLength: 1
              description: Catalogue device id
            cession_price:
              type: number
              format: double
              minimum: 0.00
              maximum: 999999999.99
            imei:
              type: string
              maxLength: 50
            pending_imei:
              type: boolean
            insured_amount:
              type: number
              format: double
              minimum: 0.01
              maximum: 999999999.99
              nullable: true
            category:
              type: string
              nullable: true
            logistic_required:
              type: boolean
              nullable: true
            catalogue_id:
              type: string
              maxLength: 255
            amount:
              type: number
              format: double
              minimum: 0.01
              maximum: 999999999.99
              nullable: true
        fees:
          $ref: '#/components/schemas/DeviceFees'
        financial_details:
          $ref: '#/components/schemas/FinancialDetails'
        campaign_id:
          type: integer
        terms:
          $ref: '#/components/schemas/Terms'
        reservation_id:
          type: string
        signature_process_id:
          type: number
          format: int64
        signature_type:
          $ref: '#/components/schemas/SignatureType'
        old_subscription_terminal_id:
          type: integer
          format: int64
          nullable: true


  x-releaseInfo:
    description: >

      ### Release Notes
      * **2.38.2** : Removed SpecialTreatment from UserInfo response.
        - Removed `special_treatment` field from GET /orgs/{orgId}/users/{userId} response.
        - Removed `SpecialTreatment` schema. Special treatment data is available via V4 API.

      * **2.38.1** : Align `ErrorMessage.code` type with Hijack runtime payload.
        - Changed `ErrorMessage.code` from `integer` to `string`.
        - Added example and description clarifying zero-padded values (for example, `"0001"`, `"0013"`).

      * **2.38.0** : Remove email regex validation from swagger fields.
        - Removed `pattern` from `old_email`, `new_email`, `email` and `registration_email` fields. Format validation is enforced in code.

      * **2.37.2** : Make <code>catalogue_id<code> mandatory in 
        - POST /orgs/{orgId}/subscriptions/{subscriptionId}/devices.
      
      * **2.37.1** : Deprecate endpoints.
        - GET /orgs/{orgId}/subscriptions/{subscriptionId}/services.
        - PATCH /orgs/{orgId}/subscriptions/{subscriptionId}/services/{serviceId}.
        - GET /orgs/{orgId}/subscriptions/{subscriptionId}/blocks.
      
      * **2.37.0** : Removed deprecated PATCH endpoint.
        - PATCH /orgs/{orgId}/accounts/{accountId}/paymentinfo (DELETE).
        - Removed ChangeAccountPaymentInfoRequest schema.

      * **2.36.8** : Deprecated financial fields that are no longer sent to backend.
        - Deprecated Employment schema (profession, professional_area, company, income, income_source, activity_country_code, professional_use).
        - Deprecated income_source property within Employment schema.
        - Deprecated pre_booking property within financial_details.
        - These fields are still accepted in API requests for backward compatibility but are no longer processed or sent to MySim backend.

      * **2.36.7** : Add fields DeviceResponse schema.
        - Added delivery_date field to DeviceResponse schema.

      * **2.36.6** : Add fields to DeviceInfo schema.
        - Added terminal_code field to DeviceInfo schema.
        - Added terminal_category_type field to DeviceInfo schema.

      * **2.36.5** : Add services array field to Ftth schema.
        - Added for endpoint POST /orgs/{orgId}/signups.
      
      * **2.36.4**: Changed description and example of SpecialTreatment Object
        - Changed for endpoint GET /orgs/{orgId}/users/{userId}
          
      * **2.36.3**: Removed unused specialTreatments Object
        - Removed for endpoint GET /orgs/{orgId}/signups/master-data

      * **2.36.2** Removed unused deprecated endpoints.
        - GET /orgs/{orgId}/subscriptions/{subscriptionId}/balance
        - GET /orgs/{orgId}/subscriptions/{subscriptionId}/consumption/detail
      
      * **2.36.1**: Permission unification.
      
      * **2.36.0** : Changes typo of reservation_id to String.
        - Changed for endpoint POST /orgs/{orgId}/subscriptions/{subscriptionId}/devices.
        - Changed for endpoint GET /orgs/{orgId}/subscriptions/{subscriptionId}/devices.
        - Changed for endpoint POST /orgs/{orgId}/signups.
        - Changed for endpoint POST /orgs/{orgId}/signups/subscriptions.
        - Changed for endpoint POST /orgs/{orgId}/signups/migration.

      * **2.35.3** : Fix HTML content in endpoints description.

      * **2.35.2** : Deprecate endpoints and delete older endpoints.
        - GET /orgs/{orgId}/accounts/{accountId}/paymentinfo (DEPRECATE).
        - PATCH /orgs/{orgId}/accounts/{accountId}/paymentinfo (DEPRECATE).
        - POST /orgs/{orgId}/signups/register-sell-payment (DELETE).
        - GET /orgs/{orgId}/users/tree/full (DELETE)
      
      * **2.35.1** : Changes to response in GET /orgs/{orgId}/accounts/{accountId}/invoices.
        - Added <code>value_total<code> field to InvoiceInfoDetail schema like it was previously.
      
      * **2.35.0** : Changes to response in GET /orgs/{orgId}/accounts/{accountId}/invoices.
        - Added <code>cycle</code> field to InvoiceInfoDetail schema.
      
      * **2.34.0** : Changes to response in GET /orgs/{orgId}/subscriptions/{subscriptionId}/devices.
        - Add field devices[].fees.installment_plan.financed_by
        - Add field devices[].fees.final_installment_plan.financed_by
        - Marked field devices[].device_info.financed_by as deprecated.

      * **2.33.4** : Add <code>commitment_uuid<code> field to Penalty schema.
        - Added for endpoint POST /orgs/{orgId}/penalties/{accountId}.
        - Added for endpoint POST /orgs/{orgId}/penalties/{accountId}/subscription/{subscriptionId}.
        - Added for endpoint POST /orgs/{orgId}/penalties/{accountId}/subscription/uuid/{subscriptionUUID}.
        - Added for endpoint POST /orgs/{orgId}/penalties/{computePenaltyId}.

      * **2.33.3** : Add <code>subscription_terminal_id<code> field to Penalty schema.
        - Added for endpoint POST /orgs/{orgId}/penalties/{accountId}.
        - Added for endpoint POST /orgs/{orgId}/penalties/{accountId}/subscription/{subscriptionId}.
        - Added for endpoint POST /orgs/{orgId}/penalties/{accountId}/subscription/uuid/{subscriptionUUID}.
        - Added for endpoint POST /orgs/{orgId}/penalties/{computePenaltyId}.

      * **2.33.2** : Add endpoint for get penalties by subscriptionUUID.
        - Added endpoint GET /orgs/{orgId}/penalties/{accountId}/subscriptions/{subscriptionUUID}.
      
      * **2.32.0** : Add new value to the <code>PaymentMethod<code> ENUM.
        - Added <code>RECURRING_CREDIT_CARD</code> value to the <code>payment_method</code> ENUM in GET /orgs/{orgId}/accounts/{accountId}/paymentinfo.

      * **2.31.0** : Add <code>catalogue_id<code> and <code>logistic_required<code> fields to Device schema.
        - Added for endpoint POST /orgs/{orgId}/signups.
        - Added for endpoint POST /orgs/{orgId}/signups/migration.
        - Added for endpoint POST /orgs/{orgId}/signups/subscriptions.
        - Added for endpoint POST /orgs/{orgId}/subscriptions/{subscriptionId}/devices.
      
      * **2.30.0** : Add <code>category<code> field to Device schema.
        - Added for endpoint POST /orgs/{orgId}/signups.
        - Added for endpoint POST /orgs/{orgId}/signups/migration.
        - Added for endpoint POST /orgs/{orgId}/signups/subscriptions.
        - Added for endpoint POST /orgs/{orgId}/subscriptions/{subscriptionId}/devices.
      
      * **2.29.0** : Added new field in GET /orgs/{orgId}/signups:
        - Added <code>work_order_id</code> field.
      
      * **2.28.9** : Added new field in GET /orgs/{orgId}/accounts/{accountId}/contracts:
        - Added <code>contract_id</code> field.
      
      * **2.28.8** : Added new fields in POST /orgs/{orgId}/subscriptions/{subscriptionId}/devices:
        - Added <code>old_subscription_terminal_id</code> to main object.
        - Added <code>discount_final_payment_value</code> field to InstallmentPlan.
        - Added <code>is_promotional_renew</code> field to InstallmentPlan.
      
      * **2.28.7** : Added new fields inside Permanence Object in GET /orgs/{orgId}/subscriptions/{subscriptionId}/device:
        - Added <code>current_duration_days</code> field to Permanence.
        - Added <code>penalty_amount</code> field to Permanence.
        - Added <code>current_penalty_amount</code> field to Permanence.
                    
      * **2.28.6** : Added new field in GET /orgs/{orgId}/accounts/{accountId}/tax:
        - Added <code>start_date</code> field to TaxAccountInfo.
      
      * **2.28.5** : Added new field in POST /orgs/{orgId}/signups:
        - Added <code>ftth.access_reuse_choice</code> field.
      
      * **2.28.4** : Fixing sdk generation issue.
      
      * **2.28.3** : Added new field in POST /orgs/{orgId}/signups:
        - Added <code>ftth.access_reuse</code> field.
      
      * **2.28.2** : Fixed field example in POST /orgs/{orgId}/subscriptions/{subscriptionId}/devices:
        - Fixed <code>province_id</code> example. Now is string as it should be.
      
      * **2.28.1** : Added new fields to POST /orgs/{orgId}/subscriptions/{subscriptionId}/devices:
        - Added <code>dealer_id</code> field
        - Added <code>shop_id</code> field
      
      * **2.28.0** : Several additions.
        - Added <code>pay_date</code> field to GET /orgs/{orgId}/accounts/{accountId}/invoices
        - Added <code>ECI</code> enum value to <code>payment_method</code> field in GET /orgs/{orgId}/accounts/{accountId}/paymentinfo
      
      * **2.27.0** : Added new field in GET /orgs/{orgId}/accounts/{accountId}/invoices:
        - Added <code>status</code> field to request.
      
      * **2.26.0** : Changed response from GET /orgs/{orgId}/accounts/{accountId}/paymentinfo:
        - Added <code>payment_method</code> from request.
      
      * **2.25.4** : Deprecated fields in POST /orgs/{orgId}/subscriptions/{subscriptionId}/devices:
        - address_id, description, block, bis, stair, letter, hand1, hand2, technical_id deprecated.
      
      * **2.25.3** : Added new enum values to Status schema:
        - Added 82 to id, and PENDIENTE A DESACTIVAR to value.
      
      * **2.25.2** : Added info to POST /orgs/{orgId}/subscriptions/{subscriptionId}/devices:
        - Added maxLength, description and example to <code>province_id</code>.
      
      * **2.25.1** : Removed field from POST /orgs/{orgId}/subscriptions/{subscriptionId}/devices:
        - Removed <code>province</code> from request.
      
      * **2.25.0** : Added new field POST /orgs/{orgId}/subscriptions/{subscriptionId}/devices:
        - Added <code>signature_type</code> optional field to request.
      
      * **2.24.0** : Added new fields POST /orgs/{orgId}/signups:
        - Added <code>app_id</code> optional field to request.
        - Added <code>channel_id</code> optional field to request.
        - Added <code>signature_type</code> optional field to request.
        - Added <code>PAYMENTS</code> to platform enum in signups and devices endpoints.
      
      
      * **2.23.0** : Added new field and query param to GET /orgs/{orgId}/accounts/{accountId}/tax:
        - Added <code>historical_changes</code> field to response
        - Added <code>include_historical_changes</code> query param.
      
      * **2.22.0** : Added new field to GET /orgs/{orgId}/accounts/{accountId}:
        - Added <code>customer_id</code> field to response
      
      * **2.21.0** : Change response to GET /orgs/{orgId}/subscriptions/{subscriptionId}/devices:
        - Added final_installment_plan to Fees
        - Removed contract_detail to DeviceResponse
      
      * **2.20.0** : Added new fields to POST /orgs/{orgId}/signups:
        - Added credit_limit to SignupsScoring
        - Added credit_limit_available to SignupsScoring
      
      * **2.19.1** : Fix devices fields for business logic
        - Fields <code>granted_amount</code> and <code>credit_line_amount</code> are now Long.
        - Fields <code>fees</code> and <code>reservation_id</code> are now mandatory
      
      * **2.19.0** : Added new functionality to mobile only signups
        - Added new functionality to add devices in mobile onlye signups
      
      * **2.19.0** : Adds new field subscription_terminal_id
         - Adds field subscription_terminal_id to response of POST /orgs/{orgId}/signups in each subscription (account_info.subscriptions).
         - Adds field subscription_terminal_id to response of POST /orgs/{orgId}/subscriptions/{subscriptionId}/devices.
      
      * **2.18.1** : Fix field <code>order_id</code> type in POST /orgs/:orgId/subscriptions/:subscriptionId/devices
         - Fixed field <code>order_id</code> type from long to string
      
      * **2.18.0** : Added new fields to POST /orgs/:orgId/subscriptions/:subscriptionId/devices
         - Added <code>platform</code>, <code>payment_link</code>, <code>tax</code> fields
      
      * **2.17.0** : Adds Apple Watch subscription
         - Adds the Apple Watch subscription type (13) to all endpoints.
      
      * **2.16.0** : Refactor specification to use components and obfuscate examples
         - Refactor specification to use components and obfuscate examples
      
      * **2.15.1** : Removed required from <code>registration_email</code> field in POST /orgs/{orgId}/signups/migration
         - Removed required from <code>registration_email</code> field in POST /orgs/{orgId}/signups/migration
      
      * **2.15.0** : Add new values to GET /orgs/{orgId}/signups/master-data
         - Added <code>occupations</code> and <code>occupation_sectors</code> to GET /orgs/{orgId}/signups/master-data
      
      * **2.14.0** : Removed unused deprecated endpoints.
         -   /orgs/{orgId}/users/{userId}/accounts:
         -   /orgs/{orgId}/subscriptions/{subscriptionId}/consumption-limit:
      
      * **2.13.0** : Add ott subscription type to POST /orgs/{orgId}/signups/migration
      
      * **2.12.2** : Add signature_process_id:
         - POST /orgs/:orgId/signups 
         - POST /orgs/:orgId/signups/migration
         - POST /orgs/:orgId/signups/subscriptions 
         - POST /orgs/:orgId/subscriptions/:subscriptionId/devices
      
      * **2.12.1** : Add donor_use to endpoint:
        - POST /orgs/{orgId}/signups/migration:
      
      * **2.11.0** : Removed unused deprecated endpoints.
        - GET/PUT /orgs/{orgId}/users/{expeditionUserId}/expeditions
        - PATCH /orgs/{orgId}/subscriptions/{subscriptionId}/accounts
        - PATCH /orgs/{orgId}/subscriptions/{subscriptionId}/accounts/{accountNumber}
        - PATCH /orgs/{orgId}/subscriptions/{subscriptionId}/migrate-to-prepaid
        - PATCH /orgs/{orgId}/subscriptions/{subscriptionId}/migrate-to-prepaid/{accountNumber}
        - PATCH /orgs/{orgId}/subscriptions/{subscriptionId}/migrate-to-postpaid
        - PATCH /orgs/{orgId}/subscriptions/{subscriptionId}/migrate-to-postpaid/{accountNumber}
        - DELETE /orgs/{orgId}/subscriptions/{subscriptionId}/in-flight
        - PUT /orgs/{orgId}/subscriptions/{subscriptionId}/consumption-limit
        - DELETE /orgs/{orgId}/subscriptions/{subscriptionId}/consumption-limit
        - PUT /orgs/{orgId}/subscriptions/{subscriptionId}/promotions
        - DELETE /orgs/{orgI d}/subscriptions/{subscriptionId}/promotions/{promotionId}
        - PATCH /barrings
        - POST /notifications/external

      * **2.10.0** : Add get Account contracts endpoint.
        - Added endpoint GET /orgs/{orgId}/accounts/{accountId}/contracts.

      * **2.9.1** : Add insured_amount field to Device schema.
        - Added for endpoint POST /orgs/{orgId}/signups.
        - Added for endpoint POST /orgs/{orgId}/signups/migration.
        - Added for endpoint POST /orgs/{orgId}/signups/subscriptions.
        - Added for endpoint POST /orgs/{orgId}/subscriptions/{subscriptionId}/devices.

      * **2.9.0** : Add scoring field to POST /orgs/{orgId}/subscriptions/{subscriptionId}/devices
        - Add scoring_id field to POST /orgs/{orgId}/subscriptions/{subscriptionId}/devices endpoint.
        - Changed credit_line_amount field from integer to double
      
      * **2.8.2** : Remove Broadband component
        - Removed unused Broadband component.
      
      * **2.8.1** : Adds Device Insurance subscription
        - Adds the Device Insurance subscription type (11) to all endpoints.
      
      * **2.8.0** : Change PATCH /orgs/{orgId}/subscriptions/{subscriptionId}/sim-replacement to return risk decision
        - Change response
          - /orgs/{orgId}/subscriptions/{subscriptionId}/sim-replacement to return risk decision: Now the service return 206 when the field risk decision has the value "r", "x" or "n/a".
      
      * **2.7.0** : Change PATCH /subscriptions/{subscriptionId}/products to return risk decision
        - Change response
          - /subscriptions/{subscriptionId}/products to return risk decision: Now the service return 202 when the field risk decision has the value "r", "x" or "n/a".
      
      * **2.6.3** :  Add field to com.masmovil.mascustomers.client.model.UserBusinessResponsable nationality_value.                      

      * **2.6.2** : Change HTTP status code
        - Change from 206 to 202, when the field risk decision has the value "r", "x" or "n/a" on the next endpoints:
          - POST /orgs/{orgId}/subscriptions/{subscriptionId}/devices.
          - POST /orgs/{orgId}/signups to return risk decision.
          - POST /orgs/{orgId}/signups/migration to return risk decision.
          - POST /orgs/{orgId}/signups/subscriptions to return risk decision.
      
      * **2.6.1** : Adds Netflix subscription
        - Adds the Netflix subscription type (12) to all endpoints.

      * **2.6.0** : Change POST /orgs/{orgId}/subscriptions/{subscriptionId}/devices to return risk decision
        - Change response
          - /orgs/{orgId}/subscriptions/{subscriptionId}/devices to return risk decision: Now the service return 206 when the field risk decision has the value "r", "x" or "n/a".

      * **2.5.0** : Change POST /signups/migration to return risk decision
        - Change response
          - /signups/migration to return risk decision: Now the service return 206 when the field risk decision has the value "r", "x" or "n/a".

      * **2.4.0** : Change POST /signups/subscriptions to return risk decision
        - Change response
          - /signups/subscriptions to return risk decision: Now the service return 206 when the field risk decision has the value "r", "x" or "n/a".
      
      * **2.3.8** : Creation this change logs and delete Customers Tag and delete endpoint getDeviceByCustomerId
        - Creation this release notes
        - Delete Tag Customers
        - Delete endpoint
          - <del>/orgs/{orgId}/customers/{customerId}/devices</del>
