openapi: 3.0.0
info:
  description: |
    I am MasSubscriptions API. My intention is to provide a set of REST services for handling subscriptions and their 
    related entities.
  version: 2.0.0
  title: MasSubscriptions
servers:
  - description: production
    url: 'https://subscriptions.masstack.com/v2/'
  - description: staging
    url: 'https://subscriptions.sta.masstack.com/v2/'
security:
  - bearerAuth: [ ]

tags:
  - name: Subscriptions
    description: Subscription resource contains all the data applicable to any kind of subscription regardless its type
  - name: Bundles
    description: Bundle resource represents a bundle containing multiple subscriptions according to certain commercial definition
  - name: Promotions
    description: Promotion resource represents a promotion associated to a subscription
  #  - description: Free Units Package resource represents a free units package associated to a subscription
  #    name: Free Units Packages
  - name: Devices
    description: Device resource represents a device associated to a subscription
  - name: AddOns
    description: Add-ons resource represents a add-ons (value-added service) associated to a subscription
  - name: Amazon Prime
    description: Amazon Prime resource represents an amazon prime subscription containing specific amazon prime data besides all data applicable to any subscription
  - name: Max
    description: Max resource represents a Max streaming subscription containing specific Max data besides all data applicable to any subscription
  - name: Mobile
    description: Mobile resource represents a mobile line subscription containing specific mobile related data besides all data applicable to any subscription
  - name: Broadband
    description: Broadband resource represents a broadband connection subscription containing specific broadband connection data besides all data applicable to any subscription
  - name: Landline
    description: Landline resource represents a landline subscription containing specific landline data besides all data applicable to any subscription
  - name: Orange TV
    description: Orange TV resource represents a Orange TV subscription containing specific Orange TV data besides all data applicable to any subscription
  - name: Orange TV Libre
    description: Orange Tv Libre resource represents a Orange Tv Libre subscription containing specific Orange Tv Libre data besides all data applicable to any subscription
  - name: Disney
    description: Disney resource represents a Disney subscription containing specific Disney data besides all data applicable to any subscription
  - name: AgileTv
    description: AgileTv resource represents an AgileTv subscription containing specific AgileTv data besides all data applicable to any subscription
  - name: Netflix
    description: Netflix resource represents a Netflix subscription containing specific Netflix data besides all data applicable to any subscription
  - name: Credit Limits
    description: Credit limits resource represents credit limits associated to a subscription or a tenant
  - name: Change Requests
    description: Change requests resource represents a change request over a bundle or subscription
  - name: Commitments
    description: Commitments resource represents a customer commitment linked to a promotion or device
  - name: DeviceInsurance
    description: DeviceInsurance resource represents a Device Insurance subscription containing specific Device Insurance data besides all data applicable to any subscription
  - name: Multisim
    description: Multisim resource represents a multisim subscription containing specific multisim related data besides all data applicable to any subscription
  - name: Payment Plans
    description: Payment Plans resource represents a payment plan associated to a device that is associated to a subscription
  - name: Operations
    description: Subscription administration operations
  - name: Contracts
    description: Contract documents associated with subscriptions or bundles

paths:
  '/orgs/{org}/bundles':
    post:
      tags:
        - Bundles
      summary: Create a new bundle
      description: Create a new bundle with the provided data
      operationId: createBundle
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
      requestBody:
        description: Bundle data
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Bundle'
        required: true
      responses:
        '201':
          description: Bundle successfully created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Bundle'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

    get:
      tags:
        - Bundles
      summary: Search subscriptions bundles
      description: Search subscription bundles providing certain search criteria
      operationId: getBundlesByProperties
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BundlesSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/bundles/{bundleId}':
    get:
      tags:
        - Bundles
      summary: Get bundle
      description: Get subscription bundle basic info
      operationId: getBundle
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Bundle'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

    patch:
      tags:
        - Bundles
      summary: Update an existing bundle
      description: Update variable fields of bundles
      operationId: updateBundle
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
      requestBody:
        description: Array of operations to be applied to the bundle
        content:
          application/json:
            examples:
              UpdateBundleStatus:
                description: Update bundle status
                value:
                  - op: replace
                    path: status
                    value: ACTIVE
            schema:
              '$ref': '#/components/schemas/OperationsSet'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Bundle'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/bundles/{bundleId}/subscriptions':
    get:
      tags:
        - Subscriptions
      summary: Get bundle subscriptions
      description: Get subscriptions belonging to a bundle
      operationId: getBundleSubscriptions
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionsSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions':
    get:
      tags:
        - Subscriptions
      summary: Search subscriptions
      description: Search subscriptions matching specific properties
      operationId: getSubscriptionsByProperties
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - $ref: '#/components/parameters/DeviceIdQueryParam'
        - $ref: '#/components/parameters/LegacyDeviceIdQueryParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionsSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
  '/orgs/{org}/subscriptions/devices':
    get:
      tags:
        - Devices
      summary: Get devices
      description: Get all devices filtering. This endpoint cannot be called without a query parameter.
      operationId: getDevices
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - name: mac_address
          in: query
          required: false
          description: Mac address filter. Required if 'serial_number' filter is not provided
          schema:
            type: string
          example: 00-B0-D0-63-C2-26
        - name: serial_number
          in: query
          required: false
          description: Serial number filter. Required if 'mac_address' filter is not provided
          schema:
            type: string
          example: SN-48392A7F4B
      responses:
        '200':
          description: Devices found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DevicesSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}':
    get:
      tags:
        - Subscriptions
      summary: Get subscription
      description: Get subscriptions details by subscription ID
      operationId: getSubscriptionBasicInfo
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    patch:
      tags:
        - Subscriptions
      summary: Update subscription
      description: |
        Update variable fields of subscriptions, applicable to subscription generic data that is not specific for a given type
      operationId: updateSubscriptionBasicInfo
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Array of operations to be applied to the subscription generic data fields
        content:
          application/json:
            examples:
              DeactivateSubscription:
                description: Deactivate an active subscription
                value:
                  - op: deactivate
                    reason: SUBSCRIBER_RESIGNATION
              CancelSubscription:
                description: Cancel an active subscription
                value:
                  - op: cancel
                    reason: SUBSCRIBER_RESIGNATION
              MoveSubscriptionToBundle:
                description: Migrate subscription to new bundle
                value:
                  - op: migrate
                    path: bundle_related_info
                    value: 1233-35df-4ffe-bca6-c0ed0c28cb39
            schema:
              '$ref': '#/components/schemas/OperationsSet'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '409':
          $ref: '#/components/responses/SubscriptionConflict'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/cancel':
    post:
      tags:
        - Subscriptions
      summary: Cancel subscription
      description: Cancel an active subscription
      operationId: cancelSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Cancellation request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionCancellationRequest'
        required: true
      responses:
        '202':
          description: Cancellation process started
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '409':
          $ref: '#/components/responses/SubscriptionConflict'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/deactivate':
    post:
      tags:
        - Subscriptions
      summary: Deactivate subscription
      description: |
        Starts the deactivation process of the subscription.
      operationId: deactivateSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Deactivate subscription data
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionDeactivationRequest'
        required: true
      responses:
        '202':
          description: Deactivation process started
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '409':
          $ref: '#/components/responses/SubscriptionConflict'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/activate':
    post:
      tags:
        - Subscriptions
      summary: Activate subscription
      description: Activate a subscription. This endpoint will only consider the activation date if it is a prepaid subscription.
      operationId: activateSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Activation request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionActivationRequest'
      responses:
        '202':
          description: Activation process started
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/promotions':
    post:
      tags:
        - Promotions
      summary: Add subscription promotion
      description: Add a new promotion to an existing subscription
      operationId: addSubscriptionPromotion
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/OriginUserHeaderParam'
        - $ref: '#/components/parameters/OriginSystemHeaderParam'
      requestBody:
        description: Promotion input data
        content:
          application/json:
            examples:
              Promotion:
                description: Adding a Promotion to an existing subscription
                value:
                  catalogue_promotion_id: "1572"
            schema:
              $ref: '#/components/schemas/Promotion'
        required: true
      responses:
        '201':
          description: Promotion successfully added to the subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Promotion'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    get:
      tags:
        - Promotions
      summary: Get subscription promotions
      description: Get promotions of subscription
      operationId: getSubscriptionPromotions
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/ExpirationDateQueryParam'
        - $ref: '#/components/parameters/PromotionStatusQueryParam'
        - $ref: '#/components/parameters/BundleIdQueryParam'
        - $ref: '#/components/parameters/CataloguePromotionIdQueryParam'
      responses:
        '200':
          description: Promotions found for the subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromotionsSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/promotions/{promotionId}':
    get:
      tags:
        - Promotions
      summary: Get subscription promotion
      description: Get info for a specific promotion of subscription
      operationId: getSubscriptionPromotion
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/PromotionIdPathParam'
      responses:
        '200':
          description: Promotion found for the subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Promotion'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/PromotionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    patch:
      tags:
        - Promotions
      summary: Patches a subscription promotion
      description: Patches specific fields of a subscription promotion
      operationId: patchSubscriptionPromotion
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/PromotionIdPathParam'
        - $ref: '#/components/parameters/OriginUserHeaderParam'
        - $ref: '#/components/parameters/OriginSystemHeaderParam'
      requestBody:
        description: Array of operations to apply to subscription promotion
        content:
          application/json:
            example:
              - op: add
                path: status
                value: CANCELLED
            schema:
              '$ref': '#/components/schemas/OperationsSet'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                '$ref': '#/components/schemas/Promotion'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/PromotionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    put:
      tags:
        - Promotions
      summary: Updates a subscription promotion
      description: Updates a subscription promotion with new data
      operationId: updateSubscriptionPromotion
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/PromotionIdPathParam'
        - $ref: '#/components/parameters/OriginUserHeaderParam'
        - $ref: '#/components/parameters/OriginSystemHeaderParam'
      requestBody:
        description: Promotion data to replace
        content:
          application/json:
            examples:
              Promotion:
                description: Promotion to update
            schema:
              $ref: '#/components/schemas/Promotion'
        required: true
      responses:
        '200':
          description: Promotion successfully updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Promotion'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/PromotionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/promotions/{promotionId}/status_history':
    get:
      tags:
        - Promotions
      summary: Get subscription promotion status history
      description: Get status history for a specific promotion of subscription
      operationId: getSubscriptionPromotionStatusHistory
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/PromotionIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/PromotionStatusQueryParam'
      responses:
        '200':
          description: Promotion status history found for the subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromotionStatusHistorySet'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/PromotionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/promotions/{promotionId}/deactivate':
    post:
      tags:
        - Promotions
      summary: Deactivate a subscription promotion
      description: Deactivate a subscription existing promotion
      operationId: deactivateSubscriptionPromotion
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/PromotionIdPathParam'
        - $ref: '#/components/parameters/OriginUserHeaderParam'
        - $ref: '#/components/parameters/OriginSystemHeaderParam'
      requestBody:
        description: Promotion deactivation reason
        content:
          application/json:
            schema:
              '$ref': '#/components/schemas/PromotionTerminationRequest'
        required: true
      responses:
        '202':
          description: Deactivation process started
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/promotions/{promotionId}/cancel':
    post:
      tags:
        - Promotions
      summary: Cancel a subscription promotion
      description: Cancel a subscription existing promotion that is not already active
      operationId: cancelSubscriptionPromotion
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/PromotionIdPathParam'
        - $ref: '#/components/parameters/OriginUserHeaderParam'
        - $ref: '#/components/parameters/OriginSystemHeaderParam'
      requestBody:
        description: Promotion cancellation reason
        content:
          application/json:
            schema:
              '$ref': '#/components/schemas/PromotionTerminationRequest'
        required: true
      responses:
        '202':
          description: Cancellation process started
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/promotions/{promotionId}/commitments/{commitmentId}':
    get:
      tags:
        - Commitments
      summary: Get a commitment by ID
      description: Get info for a specific commitment
      operationId: getPromotionCommitmentById
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/PromotionIdPathParam'
        - $ref: '#/components/parameters/CommitmentIdPathParam'
      responses:
        '200':
          description: Commitment found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Commitment'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/CommitmentNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    patch:
      tags:
        - Commitments
      summary: Patch promotion commitment
      description: Updates commitment's data
      operationId: patchPromotionCommitmentById
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/PromotionIdPathParam'
        - $ref: '#/components/parameters/CommitmentIdPathParam'
      requestBody:
        description: Array of operations to apply to the commitment
        content:
          application/json:
            example:
              - op: replace
                path: cancellation_date
                value: 2025-02-13T10:35:05Z
            schema:
              '$ref': '#/components/schemas/OperationsSet'
        required: true
      responses:
        '200':
          description: Promotion commitment patched successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Commitment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/CommitmentNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/add_ons':
    get:
      tags:
        - AddOns
      summary: Get subscription addOns
      description: Get add-ons (value added services) associated to the subscription
      operationId: getSubscriptionAddOns
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/LegacyAddOnIdQueryParam'
      responses:
        '200':
          description: Add-ons associated to the subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddOnsSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    post:
      tags:
        - AddOns
      summary: Add an AddOn to a subscription
      description: Add an AddOn to a subscription.
      operationId: addAddOnToSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Add AddOn to subscription body
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddOn'
      responses:
        '201':
          description: AddOn added to subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddOn'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/add_ons/{addonId}':
    get:
      tags:
        - AddOns
      summary: Get subscription addOn by addOn ID
      description: Get addOn (value added services) associated to the subscription by addon ID
      operationId: getSubscriptionAddOnById
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/AddOnIdPathParam'
      responses:
        '200':
          description: Add-on associated to the subscription found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddOn'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/AddOnNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/add_ons/{addonId}/deactivate':
    post:
      tags:
        - AddOns
      summary: Deactivate subscription AddOn
      description: |
        Starts the deactivation process of the subscription AddOn.
      operationId: deactivateSubscriptionAddOn
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/AddOnIdPathParam'
      requestBody:
        description: Deactivate subscription AddOn data
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionAddOnDeactivationRequest'
        required: true
      responses:
        '202':
          description: Deactivation process started
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/add_ons/{addonId}/promotions':
    get:
      tags:
        - Promotions
      summary: Get add-on promotions
      description: Get all promotions associated with an add-on
      operationId: getAddOnPromotions
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/AddOnIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/ExpirationDateQueryParam'
        - $ref: '#/components/parameters/PromotionStatusQueryParam'
      responses:
        '200':
          description: Promotions found for the add-on
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromotionsSet'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/AddOnNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/add_ons/{addonId}/promotions/{promotionId}':
    get:
      tags:
        - Promotions
      summary: Get add-on promotion
      description: Get info for a specific promotion of an add-on
      operationId: getAddOnPromotion
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/AddOnIdPathParam'
        - $ref: '#/components/parameters/PromotionIdPathParam'
      responses:
        '200':
          description: Promotion found for the add-on
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Promotion'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/PromotionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    patch:
      tags:
        - Promotions
      summary: Patches an add-on promotion
      description: Patches specific fields of an add-on promotion
      operationId: patchAddOnPromotion
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/AddOnIdPathParam'
        - $ref: '#/components/parameters/PromotionIdPathParam'
        - $ref: '#/components/parameters/OriginUserHeaderParam'
        - $ref: '#/components/parameters/OriginSystemHeaderParam'
      requestBody:
        description: Array of operations to apply to add-on promotion
        content:
          application/json:
            example:
              - op: replace
                path: status
                value: CANCELLED
            schema:
              '$ref': '#/components/schemas/OperationsSet'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                '$ref': '#/components/schemas/Promotion'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/PromotionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'


  #  '/orgs/{org}/subscriptions/{subscriptionId}/free_unit_packages':
  #    get:
  #      tags:
  #        - Free Units Packages
  #      summary: Get subscription free units packages
  #      description: Get free unit packages of the subscription
  #      operationId: getSubscriptionFreeUnitPackages
  #      parameters:
  #        - name: org
  #          in: path
  #          description: Organization name
  #          required: true
  #          schema:
  #            type: string
  #          example: yoigo
  #        - name: id
  #          in: path
  #          description: Subscription unique identifier
  #          required: true
  #          schema:
  #            type: string
  #          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
  #        - name: start_date
  #          in: query
  #          description: |
  #            Promotions started matching date filter. Available filters are [eq, lt, lte, gt, gte]. Format according
  #            to ISO 8601
  #          required: false
  #          style: deepObject
  #          explode: true
  #          schema:
  #            $ref: '#/components/schemas/DateFilterEnum'
  #          example: 2023-01-05T03:30:15Z
  #        - name: expiration_date
  #          in: query
  #          description: |
  #            Promotions active or expired matching date filter. Available filters are [eq, lt, lte, gt, gte].
  #            Format according to ISO 8601
  #          required: false
  #          style: deepObject
  #          explode: true
  #          schema:
  #            $ref: '#/components/schemas/DateFilterEnum'
  #          example: 2023-01-05T03:30:15Z
  #      responses:
  #        '200':
  #          description: Promotions found for the subscription
  #          content:
  #            application/json:
  #              schema:
  #                $ref: '#/components/schemas/FreeUnitsPackagesSet'
  #        '403':
  #          $ref: '#/components/responses/ForbiddenAccess'
  #        '404':
  #          $ref: '#/components/responses/SubscriptionNotFound'
  #        '500':
  #          $ref: '#/components/responses/InternalServerError'
  #        default:
  #          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/devices':
    get:
      tags:
        - Devices
      summary: Get subscription devices
      description: Get all subscription devices associated to the subscription
      operationId: getSubscriptionDevices
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - name: mac_address
          in: query
          required: false
          description: Mac address filter
          schema:
            type: string
          example: 00-B0-D0-63-C2-26
      responses:
        '200':
          description: Devices found for the subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DevicesSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    post:
      tags:
        - Devices
      summary: Add device to subscription
      description: Add a new device to a subscription
      operationId: addDeviceToSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Add device data
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Device'
      responses:
        '201':
          description: Device added to subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Device'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/devices/{deviceId}':
    get:
      tags:
        - Devices
      summary: Get device by ID
      description: Get info for a specific device
      operationId: getDeviceById
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/DeviceIdPathParam'
      responses:
        '200':
          description: Device found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Device'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/DeviceNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    patch:
      tags:
        - Devices
      summary: Patch device
      description: Updates device's data
      operationId: patchDeviceById
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/DeviceIdPathParam'
      requestBody:
        description: Array of operations to apply to the device
        content:
          application/json:
            example:
              - op: replace
                path: shipping_order_id
                value: abc123
            schema:
              '$ref': '#/components/schemas/OperationsSet'
        required: true
      responses:
        '200':
          description: Device patched successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Device'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/DeviceNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/devices/{deviceId}/commitments/{commitmentId}':
    get:
      tags:
        - Commitments
      summary: Get a commitment by ID
      description: Get info for a specific commitment
      operationId: getDeviceCommitmentById
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/DeviceIdPathParam'
        - $ref: '#/components/parameters/CommitmentIdPathParam'
      responses:
        '200':
          description: Commitment found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Commitment'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/CommitmentNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    patch:
      tags:
        - Commitments
      summary: Patch device commitment
      description: Updates commitment's data
      operationId: patchDeviceCommitmentById
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/DeviceIdPathParam'
        - $ref: '#/components/parameters/CommitmentIdPathParam'
      requestBody:
        description: Array of operations to apply to the commitment
        content:
          application/json:
            example:
              - op: replace
                path: cancellation_date
                value: 2025-02-13T10:35:05Z
            schema:
              '$ref': '#/components/schemas/OperationsSet'
        required: true
      responses:
        '200':
          description: Device commitment patched successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Commitment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/CommitmentNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/devices/{deviceId}/promotions':
    get:
      tags:
        - Promotions
      summary: Get device promotions
      description: Get all promotions associated with a device
      operationId: getDevicePromotions
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/DeviceIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/ExpirationDateQueryParam'
        - $ref: '#/components/parameters/PromotionStatusQueryParam'
      responses:
        '200':
          description: Promotions found for the device
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromotionsSet'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/DeviceNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/devices/{deviceId}/promotions/{promotionId}':
    get:
      tags:
        - Promotions
      summary: Get device promotion
      description: Get info for a specific promotion of a device
      operationId: getDevicePromotion
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/DeviceIdPathParam'
        - $ref: '#/components/parameters/PromotionIdPathParam'
      responses:
        '200':
          description: Promotion found for the device
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Promotion'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/PromotionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    patch:
      tags:
        - Promotions
      summary: Patches a device promotion
      description: Patches specific fields of a device promotion
      operationId: patchDevicePromotion
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/DeviceIdPathParam'
        - $ref: '#/components/parameters/PromotionIdPathParam'
        - $ref: '#/components/parameters/OriginUserHeaderParam'
        - $ref: '#/components/parameters/OriginSystemHeaderParam'
      requestBody:
        description: Array of operations to apply to device promotion
        content:
          application/json:
            example:
              - op: replace
                path: status
                value: CANCELLED
            schema:
              '$ref': '#/components/schemas/OperationsSet'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                '$ref': '#/components/schemas/Promotion'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/PromotionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/contracts/{contractId}':
    get:
      tags:
        - Contracts
      summary: Get a contract by ID
      description: Get info for a specific contract associated with a subscription
      operationId: getSubscriptionContract
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/ContractIdPathParam'
      responses:
        '200':
          description: Contract found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Contract'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          description: Contract not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/contracts':
    get:
      tags:
        - Contracts
      summary: Get subscription contracts
      description: Get all contracts associated with a subscription
      operationId: getSubscriptionContracts
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
      responses:
        '200':
          description: Contracts found for the subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractsSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    post:
      tags:
        - Contracts
      summary: Add contract to subscription
      description: Add a new contract to an existing subscription
      operationId: addContractToSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Contract data
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Contract'
      responses:
        '201':
          description: Contract successfully added
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Contract'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/contracts/{contractId}/documents':
    get:
      tags:
        - Contracts
      summary: Get contract documents
      description: Get documents associated with a subscription contract
      operationId: getSubscriptionContractDocuments
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/ContractIdPathParam'
      responses:
        '200':
          description: Contract documents found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDocumentsSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/history':
    get:
      tags:
        - Subscriptions
      summary: Get subscription history
      description: Search subscriptions matching specific properties
      operationId: getSubscriptionHistory
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - name: last_updated_date
          in: query
          description: |
            Changes matching date filter. Available filters are [eq, lt, lte, gt, gte]. Format according to ISO 8601
          required: false
          style: deepObject
          explode: true
          schema:
            $ref: '#/components/schemas/DateFilterEnum'
          example: 2023-01-05T03:30:15Z
        - name: status
          in: query
          required: false
          description: Subscription status filter
          schema:
            $ref: '#/components/schemas/LifeCycleStatus'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionsSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/credit_limits':
    get:
      tags:
        - Credit Limits
      summary: Get subscription credit limits
      description: Get subscription credit limits by organization ID and subscription ID
      operationId: getSubscriptionCreditLimits
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditLimitSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/bundles/{bundleId}/subscriptions/amazon_prime':
    post:
      tags:
        - Amazon Prime
      summary: Add Amazon Prime subscription to a bundle
      description: Add a new Amazon Prime subscription to a bundle with the provided data
      operationId: addAmazonPrimeSubscriptionToBundle
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
      requestBody:
        description: Amazon Prime subscription data
        content:
          application/json:
            examples:
              AmazonPrimeWithPromotions:
                description: Adding an Amazon Prime subscription with promotions and commitments to an existing bundle
                value:
                  pre_scoring_id: 1234
                  promotions:
                    - catalogue_promotion_id: "1572"
                  bundle_related_info:
                    catalogue_bundled_commercial_product_id: "8432_BUNDLED_3P"
              AmazonPrimeWithoutPromotions:
                description: Adding an Amazon Prime subscription that has no promotions to an existing bundle
                value:
                  pre_scoring_id: 1234
                  bundle_related_info:
                    catalogue_bundled_commercial_product_id: "8432_BUNDLED_3P"
            schema:
              $ref: '#/components/schemas/AmazonPrime'
        required: true
      responses:
        '201':
          description: Amazon Prime subscription successfully added to the bundle
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AmazonPrime'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

    get:
      tags:
        - Amazon Prime
      summary: Get bundle Amazon Prime subscriptions
      description: Returns an array of Amazon Prime subscriptions in a bundle
      operationId: getBundleAmazonPrimeSubscriptions
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: entitlement_id
          in: query
          description: Amazon Prime internal ID for subscription operations
          required: false
          schema:
            type: string
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AmazonPrimeSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/amazon_prime':
    get:
      tags:
        - Amazon Prime
      summary: Search Amazon Prime subscriptions
      description: |
        Search Amazon Prime subscriptions matching given criteria, at least one of the query params is required. Specific type data is included
      operationId: getAmazonPrimeSubscriptionsByProperties
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: entitlement_id
          in: query
          description: Amazon Prime internal ID for subscription operations
          required: false
          schema:
            type: string
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AmazonPrimeSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/amazon_prime/{subscriptionId}':
    get:
      tags:
        - Amazon Prime
      summary: Get Amazon Prime subscription
      description: Get Amazon Prime subscription by id. Specific type data is included
      operationId: getAmazonPrimeSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AmazonPrime'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

    patch:
      tags:
        - Amazon Prime
      summary: Update Amazon Prime subscription
      description: Update specific data of an Amazon Prime subscription
      operationId: updateAmazonPrimeSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Array of operations to apply to Amazon Prime specific data
        content:
          application/json:
            example:
              - op: add
                path: specific_data.entitlement_id
                value: abc123
            schema:
              '$ref': '#/components/schemas/OperationsSet'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                '$ref': '#/components/schemas/AmazonPrime'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/bundles/{bundleId}/subscriptions/max':
    post:
      tags:
        - Max
      summary: Add Max subscription to a bundle
      description: Add a new Max subscription to a bundle with the provided data
      operationId: addMaxSubscriptionToBundle
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
      requestBody:
        description: Max subscription data
        content:
          application/json:
            examples:
              MaxWithPromotions:
                description: Adding a Max subscription with promotions and commitments to an existing bundle
                value:
                  pre_scoring_id: 1234
                  promotions:
                    - catalogue_promotion_id: "1572"
                  bundle_related_info:
                    catalogue_bundled_commercial_product_id: "8432_BUNDLED_3P"
              MaxWithoutPromotions:
                description: Adding a Max subscription that has no promotions to an existing bundle
                value:
                  pre_scoring_id: 1234
                  bundle_related_info:
                    catalogue_bundled_commercial_product_id: "8432_BUNDLED_3P"
            schema:
              $ref: '#/components/schemas/Max'
        required: true
      responses:
        '201':
          description: Max subscription successfully added to the bundle
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Max'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

    get:
      tags:
        - Max
      summary: Get bundle Max subscriptions
      description: Returns an array of Max subscriptions in a bundle
      operationId: getBundleMaxSubscriptions
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: service_id
          in: query
          description: Max internal ID for subscription operations
          required: false
          schema:
            type: string
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39

      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MaxSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/max':
    get:
      tags:
        - Max
      summary: Search Max subscriptions
      description: |
        Search Max subscriptions matching given criteria, at least one of the query params is required. Specific type data is included
      operationId: getMaxSubscriptionsByProperties
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: service_id
          in: query
          description: Max internal ID for subscription operations
          required: false
          schema:
            type: string
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MaxSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/max/{subscriptionId}':
    get:
      tags:
        - Max
      summary: Get Max subscription
      description: Get Max subscription by id. Specific type data is included
      operationId: getMaxSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Max'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    patch:
      tags:
        - Max
      summary: Update Max subscription
      description: Update specific data of a Max subscription
      operationId: updateMaxSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Array of operations to apply to Max specific data
        content:
          application/json:
            example:
              - op: add
                path: specific_data.service_id
                value: abc123
            schema:
              '$ref': '#/components/schemas/OperationsSet'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                '$ref': '#/components/schemas/Max'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/bundles/{bundleId}/subscriptions/mobile':
    get:
      tags:
        - Mobile
      summary: Get bundle mobile subscriptions
      description: Returns the set of mobile subscriptions in a bundle
      operationId: getBundleMobileSubscriptions
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - $ref: '#/components/parameters/MsisdnQueryParam'
        - name: imsi
          in: query
          description: IMSI (International Mobile Subscriber Identity)
          required: false
          schema:
            type: number
          example: 214040000000000
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MobileSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/mobile':
    get:
      tags:
        - Mobile
      summary: Search mobile subscriptions
      description: Search mobile subscriptions matching certain criteria. Specific type data is included
      operationId: getMobileSubscriptionsByProperties
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - $ref: '#/components/parameters/MsisdnQueryParam'
        - name: imsi
          in: query
          description: IMSI (International Mobile Subscriber Identity)
          required: false
          schema:
            type: number
          example: 214040000000000
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MobileSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/mobile/{subscriptionId}':
    get:
      tags:
        - Mobile
      summary: Get mobile subscription
      description: Get Mobile subscription by id, including specific type data
      operationId: getMobileSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Mobile'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/bundles/{bundleId}/subscriptions/broadband':
    get:
      tags:
        - Broadband
      summary: Get bundle broadband subscriptions
      description: Returns the set of broadband subscriptions in a bundle
      operationId: getBundleBroadbandSubscriptions
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: legacy_service_id
          in: query
          description: Work order id according to mas-installations definition. Required if the 'legacy_id' and 'legacy_account_id' filters are not provided
          required: false
          schema:
            type: string
          example: MYSIM_9395450
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BroadbandSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/broadband':
    get:
      tags:
        - Broadband
      summary: Search broadband subscriptions
      description: Search broadband subscriptions matching certain criteria. Specific type data is included
      operationId: getBroadbandSubscriptionsByProperties
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: legacy_service_id
          in: query
          description: Work order id according to mas-installations definition. Required if 'legacy_id' and 'legacy_account_id' filters are not provided
          required: false
          schema:
            type: string
          example: MYSIM_9395450
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BroadbandSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/broadband/{subscriptionId}':
    get:
      tags:
        - Broadband
      summary: Get broadband subscription
      description: Get Broadband subscription by id, including specific type data
      operationId: getBroadbandSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Broadband'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/bundles/{bundleId}/subscriptions/landline':
    get:
      tags:
        - Landline
      summary: Get bundle landline subscriptions
      description: Returns landline subscriptions in a bundle
      operationId: getBundleLandlineSubscriptions
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: fixed_phone_number
          in: query
          description: Landline fixed phone number
          required: false
          schema:
            type: string
          example: +34913319009
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LandlineSet'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/landline':
    get:
      tags:
        - Landline
      summary: Search landline subscriptions
      description: Search landline subscriptions matching certain criteria. Specific type data is included
      operationId: getLandlineSubscriptionsByProperties
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: fixed_phone_number
          in: query
          description: Landline fixed phone number
          required: false
          schema:
            type: string
          example: +34913319009
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LandlineSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/landline/{subscriptionId}':
    get:
      tags:
        - Landline
      summary: Get landline subscription
      description: Get landline subscription by id, including specific type data
      operationId: getLandlineSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Landline'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/bundles/{bundleId}/subscriptions/orange_tv':
    post:
      tags:
        - Orange TV
      summary: Add Orange TV subscription to a bundle
      description: Add a new Orange TV subscription to a bundle with the provided data
      operationId: addOrangeTvSubscriptionToBundle
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
      requestBody:
        description: Orange TV subscription data
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrangeTv'
        required: true
      responses:
        '201':
          description: Orange TV subscription successfully added to the bundle
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrangeTv'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

    get:
      tags:
        - Orange TV
      summary: Get bundle Orange TV subscriptions
      description: Returns an array of Orange TV subscriptions in a bundle
      operationId: getBundleOrangeTvSubscriptions
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: registration_email
          in: query
          description: Registration email the subscription is linked to.
          required: false
          schema:
            type: string
          example: "peter.sellers@monty.com"
        - name: service_id
          in: query
          description: Provider service id the subscription is linked to.
          required: false
          schema:
            type: string
          example: "masmovil003141592"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrangeTvSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/orange_tv':
    get:
      tags:
        - Orange TV
      summary: Search Orange TV subscriptions
      description: |
        Search Orange TV subscriptions matching given criteria, at least one of the query params is required. Specific type data is included
      operationId: getOrangeTvSubscriptionsByProperties
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: registration_email
          in: query
          description: Registration email the subscription is linked to.
          required: false
          schema:
            type: string
          example: "peter.sellers@monty.com"
        - name: service_id
          in: query
          description: Provider service id the subscription is linked to.
          required: false
          schema:
            type: string
          example: "masmovil003141592"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrangeTvSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/orange_tv/{subscriptionId}':
    get:
      tags:
        - Orange TV
      summary: Get Orange TV subscription
      description: Get Orange TV subscription by id. Specific type data is included
      operationId: getOrangeTvSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrangeTv'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    patch:
      tags:
        - Orange TV
      summary: Update Orange TV subscription
      description: Update specific data of a Orange TV subscription
      operationId: updateOrangeTvSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Array of operations to apply to Orange TV specific data
        content:
          application/json:
            example:
              - op: add
                path: specific_data.service_id
                value: abc123
            schema:
              '$ref': '#/components/schemas/OperationsSet'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                '$ref': '#/components/schemas/OrangeTv'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/orange_tv_libre':
    get:
      tags:
        - Orange TV Libre
      summary: Search Orange TV Libre subscriptions
      description: |
        Search Orange TV Libre subscriptions matching given criteria, at least one of the query params is required. Specific type data is included
      operationId: getOrangeTvLibreSubscriptionsByProperties
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: registration_email
          in: query
          description: Registration email the subscription is linked to.
          required: false
          schema:
            type: string
          example: "peter.sellers@monty.com"
        - name: service_id
          in: query
          description: Provider service id the subscription is linked to.
          required: false
          schema:
            type: string
          example: "masmovil003141592"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrangeTvLibreSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/orange_tv_libre/{subscriptionId}':
    get:
      tags:
        - Orange TV Libre
      summary: Get Orange Tv Libre subscription
      description: Get Orange Tv Libre subscription by id. Specific type data is included
      operationId: getOrangeTvLibreSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrangeTvLibre'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    patch:
      tags:
        - Orange TV Libre
      summary: Update Orange TV Libre subscription
      description: Update specific data of a Orange TV Libre subscription
      operationId: updateOrangeTvLibreSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Array of operations to apply to Orange TV Libre specific data
        content:
          application/json:
            example:
              - op: add
                path: specific_data.service_id
                value: abc123
            schema:
              '$ref': '#/components/schemas/OperationsSet'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                '$ref': '#/components/schemas/OrangeTvLibre'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/bundles/{bundleId}/subscriptions/orange_tv_libre':
    get:
      tags:
        - Orange TV Libre
      summary: Get bundle Orange TV Libre subscriptions
      description: Returns an array of Orange TV Libre subscriptions in a bundle
      operationId: getBundleOrangeTvLibreSubscriptions
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: registration_email
          in: query
          description: Registration email the subscription is linked to.
          required: false
          schema:
            type: string
          example: "peter.sellers@monty.com"
        - name: service_id
          in: query
          description: Provider service id the subscription is linked to.
          required: false
          schema:
            type: string
          example: "masmovil003141592"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrangeTvLibreSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/bundles/{bundleId}/subscriptions/disney':
    post:
      tags:
        - Disney
      summary: Add Disney subscription to a bundle
      description: Add a new Disney subscription to a bundle with the provided data
      operationId: addDisneySubscriptionToBundle
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
      requestBody:
        description: Disney subscription data.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Disney'
      responses:
        '201':
          description: Disney subscription successfully added.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Disney'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

    get:
      tags:
        - Disney
      summary: Get bundle Disney subscriptions
      description: Retrieve an array of Disney subscriptions in a bundle.
      operationId: getBundleDisneySubscriptions
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: user_id
          in: query
          description: Filter subscriptions by provider user id.
          required: false
          schema:
            type: string
          example: 123e4567-e89b-12d3-a456-426614174000
        - name: service_id
          in: query
          description: Filter subscriptions by provider service id.
          required: false
          schema:
            type: string
          example: 123e4567-e89b-12d3-a456-426614174000
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DisneySet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/disney':
    get:
      tags:
        - Disney
      summary: Search Disney subscriptions
      description: Retrieve a list of Disney subscriptions matching given criteria. At least one of the query parameters is required. Specific type data is included.
      operationId: getDisneySubscriptionsByProperties
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: user_id
          in: query
          description: Filter subscriptions by provider user id.
          required: false
          schema:
            type: string
          example: 123e4567-e89b-12d3-a456-426614174000
        - name: service_id
          in: query
          description: Filter subscriptions by provider service id.
          required: false
          schema:
            type: string
          example: 123e4567-e89b-12d3-a456-426614174000
        - name: product_id
          in: query
          description: Filter subscriptions by provider product id.
          required: false
          schema:
            type: string
          example: com.disney.yoigo.es.bundle.standard
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DisneySet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'


  '/orgs/{org}/subscriptions/disney/{subscriptionId}':
    get:
      tags:
        - Disney
      summary: Get Disney subscription
      description: Retrieve a specific Disney subscription by id. Specific type data is included
      operationId: getDisneySubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Disney'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

    patch:
      tags:
        - Disney
      summary: Update Disney subscription
      description: Update specific data of a Disney subscription
      operationId: updateDisneySubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Array of update operations for the Disney subscription.
        required: true
        content:
          application/json:
            schema:
              '$ref': '#/components/schemas/OperationsSet'
            example:
              - op: add
                path: specific_data.service_id
                value: abc123
      responses:
        '200':
          description: Disney subscription patched successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Disney'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/agile_tv':
    get:
      tags:
        - AgileTv
      summary: Search AgileTv subscriptions
      description: Retrieve a list of AgileTv subscriptions matching given criteria. At least one of the query parameters is required. Specific type data is included.
      operationId: getAgileTvSubscriptionsByProperties
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: service_id
          in: query
          description: Filter subscriptions by provider service id.
          required: false
          schema:
            type: string
          example: f6e5d4c3-b2a1-4098-a7b6-c5d4e3f2a1b0
        - name: product_id
          in: query
          description: Filter subscriptions by provider product id.
          required: false
          schema:
            type: string
          example: a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6
        - name: is_primary
          in: query
          description: Filter subscriptions by primary status.
          required: false
          schema:
            type: boolean
          example: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgileTvSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/bundles/{bundleId}/subscriptions/agile_tv':
    get:
      tags:
        - AgileTv
      summary: Get bundle AgileTv subscriptions
      description: Returns the set of AgileTv subscriptions in a bundle
      operationId: getBundleAgileTvSubscriptions
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: service_id
          in: query
          description: Filter subscriptions by provider service id.
          required: false
          schema:
            type: string
          example: agile-service-id-001
        - name: product_id
          in: query
          description: Filter subscriptions by provider product id.
          required: false
          schema:
            type: string
          example: agile-product-standard
        - name: is_primary
          in: query
          description: Filter subscriptions by primary status.
          required: false
          schema:
            type: boolean
          example: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgileTvSet'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/agile_tv/{subscriptionId}':
    get:
      tags:
        - AgileTv
      summary: Get AgileTv subscription
      description: Get AgileTv subscription by id, including specific type data
      operationId: getAgileTvSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgileTv'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    patch:
      tags:
        - AgileTv
      summary: Update AgileTv subscription
      description: Update specific data of an AgileTv subscription
      operationId: updateAgileTvSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Array of operations to apply to AgileTv specific data
        content:
          application/json:
            example:
              - op: add
                path: specific_data.service_id
                value: abc123
            schema:
              '$ref': '#/components/schemas/OperationsSet'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                '$ref': '#/components/schemas/AgileTv'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/change_requests/tariff':
    post:
      tags:
        - Change Requests
      summary: Create new tariff change request for existing subscription
      description: |
        Create a new tariff change request for an existing subscription. The change request will be processed asynchronously
      operationId: createSubscriptionTariffChangeRequest
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Change request data
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TariffChangeRequest'
        required: true
      responses:
        '201':
          description: Tariff change request successfully created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChangeRequest'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    get:
      tags:
        - Change Requests
      summary: Get subscription tariff change requests by properties
      description: get tariff change requests providing certain search criteria
      operationId: getSubscriptionTariffChangeRequestList
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - name: status
          in: query
          required: false
          description: Change request status filter
          schema:
            $ref: '#/components/schemas/ChangeRequestStatus'
        - name: date_scheduled
          in: query
          description: |
            Change request date scheduled matching date filter. Available filters are [eq, lt, lte, gt, gte]. 
            Format according to ISO 8601
          required: false
          style: deepObject
          explode: true
          schema:
            $ref: '#/components/schemas/DateFilterEnum'
          example: 2023-01-05T03:30:15Z
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TariffChangeRequestSet'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/change_requests/deactivation':
    post:
      tags:
        - Change Requests
      summary: Create new deactivation change request for existing subscription
      description: |
        Create a new deactivation change request for an existing subscription. The change request will be processed asynchronously
      operationId: createSubscriptionDeactivationChangeRequest
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Change request data
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionDeactivationChangeRequest'
        required: true
      responses:
        '201':
          description: Deactivation change request successfully created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionDeactivationChangeRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '409':
          $ref: '#/components/responses/ChangeRequestConflict'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    get:
      tags:
        - Change Requests
      summary: Get subscription deactivation change requests by properties
      description: get deactivation change requests providing certain search criteria
      operationId: getSubscriptionDeactivationChangeRequestList
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - name: status
          in: query
          required: false
          description: Change request status filter
          schema:
            $ref: '#/components/schemas/ChangeRequestStatus'
        - name: date_scheduled
          in: query
          description: |
            Change request date scheduled matching date filter. Available filters are [eq, lt, lte, gt, gte]. 
            Format according to ISO 8601
          required: false
          style: deepObject
          explode: true
          schema:
            $ref: '#/components/schemas/DateFilterEnum'
          example: 2023-01-05T03:30:15Z
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionDeactivationChangeRequestSet'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'


  '/orgs/{org}/subscriptions/{subscriptionId}/change_requests/email':
    post:
      tags:
        - Change Requests
      summary: Create new email change request for existing subscription
      description: |
        Create a new email change request for an existing subscription. The change request will be processed asynchronously
      operationId: createSubscriptionEmailChangeRequest
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Change request data
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailChangeRequest'
        required: true
      responses:
        '201':
          description: Email change request successfully created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailChangeRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '409':
          $ref: '#/components/responses/ChangeRequestConflict'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    get:
      tags:
        - Change Requests
      summary: Get subscription email change requests by properties
      description: get email change requests providing certain search criteria
      operationId: getSubscriptionEmailChangeRequestList
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - name: status
          in: query
          required: false
          description: Change request status filter
          schema:
            $ref: '#/components/schemas/ChangeRequestStatus'
        - name: date_scheduled
          in: query
          description: |
            Change request date scheduled matching date filter. Available filters are [eq, lt, lte, gt, gte]. 
            Format according to ISO 8601
          required: false
          style: deepObject
          explode: true
          schema:
            $ref: '#/components/schemas/DateFilterEnum'
          example: 2023-01-05T03:30:15Z
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailChangeRequestSet'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/change_requests/tariff/{changeRequestId}':
    get:
      tags:
        - Change Requests
      summary: Get tariff change request by subscription and changeRequest IDs
      description: Get info for a specific tariff change request
      operationId: getTariffChangeRequestById
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/ChangeRequestIdPathParam'
      responses:
        '200':
          description: Tariff Change request found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TariffChangeRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/ChangeRequestNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/change_requests':
    get:
      tags:
        - Change Requests
      summary: Search change requests
      description: Search subscription change requests providing certain search criteria
      operationId: getSubscriptionChangeRequestsByProperties
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - name: type
          in: query
          required: false
          description: Change request status filter
          schema:
            $ref: '#/components/schemas/ChangeRequestType'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChangeRequestSet'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/change_requests/{changeRequestId}':
    get:
      tags:
        - Change Requests
      summary: Get change request by subscriptionId and changeRequestId
      description: Get info for a specific change request
      operationId: getChangeRequestById
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/ChangeRequestIdPathParam'
      responses:
        '200':
          description: Change request found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChangeRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/ChangeRequestNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'
    patch:
      tags:
        - Change Requests
      summary: Update subscription change request by SubscriptionId and changeRequestId
      description: Update change request
      operationId: patchSubscriptionChangeRequest
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/ChangeRequestIdPathParam'
      requestBody:
        description: Array of operations to be applied to the change request fields
        content:
          application/json:
            examples:
              UpdateChangeRequestStatus:
                description: Update change request status
                value:
                  - op: replace
                    path: status
                    value: FINISHED
            schema:
              '$ref': '#/components/schemas/OperationsSet'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChangeRequest'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/ChangeRequestNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  #  '/orgs/{org}/bundles/{bundleId}/subscriptions/agile_tv':
  #    get:
  #      tags:
  #        - Agile TV
  #      summary: Get bundle Agile TV subscriptions
  #      description: Returns the set of Agile TV subscriptions in a bundle
  #      operationId: getBundleAgileTVSubscriptions
  #      parameters:
  #        - name: org
  #          in: path
  #          description: Organization identifier
  #          required: true
  #          schema:
  #            type: string
  #        - name: id
  #          in: path
  #          description: Bundle identifier
  #          required: true
  #          schema:
  #            type: string
  #      responses:
  #        '200':
  #          description: OK
  #          content:
  #            application/json:
  #              schema:
  #                $ref: '#/components/schemas/AgileTvSet'
  #        '403':
  #          $ref: '#/components/responses/ForbiddenAccess'
  #        '404':
  #          $ref: '#/components/responses/BundleNotFound'
  #        '500':
  #          $ref: '#/components/responses/InternalServerError'
  #        default:
  #          $ref: '#/components/responses/DefaultErrorResponse'
  #
  #  '/orgs/{org}/subscriptions/agile_tv':
  #    get:
  #      tags:
  #        - Agile TV
  #      summary: Search Agile TV subscriptions
  #      description: Search Agile TV subscriptions matching certain criteria. Specific type data is included
  #      operationId: getAgileTVSubscriptionsByProperties
  #      parameters:
  #        - name: org
  #          in: path
  #          description: Organization name
  #          required: true
  #          schema:
  #            type: string
  #            example: yoigo
  #        - name: legacy_account_id
  #          in: query
  #          description: |
  #            Account id the subscription is linked to. Required if 'legacy_id' filter is not provided. Linked to
  #            MySim/Apollo storage, to be deprecated.
  #          required: false
  #          schema:
  #            type: integer
  #          example: 572234234
  #        - name: registration_email
  #          in: query
  #          description: Registration email
  #          required: false
  #          schema:
  #            type: string
  #          example: pedro.almodovar@eldeseo.ly
  #      responses:
  #        '200':
  #          description: OK
  #          content:
  #            application/json:
  #              schema:
  #                $ref: '#/components/schemas/AgileTvSet'
  #        '403':
  #          $ref: '#/components/responses/ForbiddenAccess'
  #        '500':
  #          $ref: '#/components/responses/InternalServerError'
  #        default:
  #          $ref: '#/components/responses/DefaultErrorResponse'
  #
  #  '/orgs/{org}/subscriptions/agile_tv/{id}':
  #    get:
  #      tags:
  #        - Agile TV
  #      summary: Get Agile TV subscription
  #      description: Get Agile TV subscription by id, including specific type data
  #      operationId: getAgileTVSubscription
  #      parameters:
  #        - name: org
  #          in: path
  #          description: Organization name
  #          required: true
  #          schema:
  #            type: string
  #          example: yoigo
  #        - name: id
  #          in: path
  #          description: Subscription unique identifier
  #          required: true
  #          schema:
  #            type: string
  #          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
  #      responses:
  #        '200':
  #          description: OK
  #          content:
  #            application/json:
  #              schema:
  #                $ref: '#/components/schemas/AgileTv'
  #        '403':
  #          $ref: '#/components/responses/ForbiddenAccess'
  #        '404':
  #          $ref: '#/components/responses/SubscriptionNotFound'
  #        '500':
  #          $ref: '#/components/responses/InternalServerError'
  #        default:
  #          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/bundles/{bundleId}/subscriptions/netflix':
    post:
      tags:
        - Netflix
      summary: Add Netflix subscription to a bundle
      description: Add a new Netflix subscription to a bundle with the provided data
      operationId: addNetflixSubscriptionToBundle
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
      requestBody:
        description: Netflix subscription data.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Netflix'
      responses:
        '201':
          description: Netflix subscription successfully added.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Netflix'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

    get:
      tags:
        - Netflix
      summary: Get bundle Netflix subscriptions
      description: Returns the set of Netflix subscriptions in a bundle
      operationId: getBundleNetflixList
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: service_id
          in: query
          description: Partner account id the subscription is linked to
          required: false
          schema:
            type: string
          example: 572234234
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NetflixList'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/netflix':
    get:
      tags:
        - Netflix
      summary: Search Netflix subscriptions
      description: Search Netflix subscriptions matching certain criteria. Specific type data is included
      operationId: getNetflixListByProperties
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: service_id
          in: query
          description: Partner account id the subscription is linked to
          required: false
          schema:
            type: string
          example: 572234234
        - name: registration_email
          in: query
          description: Registration email the subscription is linked to.
          required: false
          schema:
            type: string
          example: "peter.sellers@monty.com"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NetflixList'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/netflix/{subscriptionId}':
    get:
      tags:
        - Netflix
      summary: Get Netflix subscription
      description: Get Netflix subscription by id, including specific type data
      operationId: getNetflixSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Netflix'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

    patch:
      tags:
        - Netflix
      summary: Update Netflix subscription
      description: Update specific data of a Netflix subscription
      operationId: updateNetflixSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Array of update operations for the Netflix subscription.
        required: true
        content:
          application/json:
            schema:
              '$ref': '#/components/schemas/OperationsSet'
            example:
              - op: add
                path: specific_data.service_id
                value: abc123
      responses:
        '200':
          description: Netflix subscription patched successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Netflix'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/bundles/{bundleId}/subscriptions/device_insurance':
    post:
      tags:
        - DeviceInsurance
      summary: Add Device Insurance subscription to a bundle
      description: Add a new Device Insurance subscription to a bundle with the provided data
      operationId: addDeviceInsuranceSubscriptionToBundle
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
      requestBody:
        description: Device Insurance subscription data
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeviceInsurance'
        required: true
      responses:
        '201':
          description: Device Insurance subscription successfully added
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceInsurance'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

    get:
      tags:
        - DeviceInsurance
      summary: Get bundle Device Insurance subscriptions
      description: Returns the set of Device Insurance subscriptions in a bundle
      operationId: getBundleDeviceInsuranceList
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - $ref: '#/components/parameters/DeviceIdQueryParam'
        - $ref: '#/components/parameters/LegacyDeviceIdQueryParam'
        - name: service_id
          in: query
          description: Id of the insured device in MySim/Apollo storage
          required: false
          schema:
            type: string
          example: 0819230465
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceInsuranceList'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/BundleNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/device_insurance':
    get:
      tags:
        - DeviceInsurance
      summary: Search Device Insurance subscriptions
      description: Search Device Insurance subscriptions matching certain criteria. Specific type data is included
      operationId: getDeviceInsuranceListByProperties
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - $ref: '#/components/parameters/DeviceIdQueryParam'
        - $ref: '#/components/parameters/LegacyDeviceIdQueryParam'
        - name: service_id
          in: query
          description: Id of the insured device in MySim/Apollo storage
          required: false
          schema:
            type: string
          example: 0819230465
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceInsuranceList'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/device_insurance/{subscriptionId}':
    get:
      tags:
        - DeviceInsurance
      summary: Get Device Insurance subscription
      description: Get Device Insurance subscription by id, including specific type data
      operationId: getDeviceInsuranceSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceInsurance'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

    patch:
      tags:
        - DeviceInsurance
      summary: Update Device Insurance subscription
      description: Update specific data of a Device Insurance subscription
      operationId: updateDeviceInsuranceSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      requestBody:
        description: Array of update operations for the Device Insurance subscription.
        required: true
        content:
          application/json:
            schema:
              '$ref': '#/components/schemas/OperationsSet'
            example:
              - op: replace
                path: specific_data.service_id
                value: 0819230465
      responses:
        '200':
          description: Device Insurance subscription patched successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceInsurance'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/bundles/{bundleId}/subscriptions/multisim':
    get:
      tags:
        - Multisim
      summary: Get bundle Multisim subscriptions
      description: Returns the set of Multisim subscriptions in a bundle
      operationId: getBundleMultisimList
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/BundleIdPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - name: main
          in: query
          description: Main subscription identifier
          required: false
          schema:
            type: string
            format: uuid
          example: 123e4567-e89b-12d3-a456-426614174000
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MultisimList'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/multisim/{subscriptionId}':
    get:
      tags:
        - Multisim
      summary: Get multisim subscription
      description: Get Multisim subscription by id, including specific type data
      operationId: getMultisimSubscription
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Multisim'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '404':
          $ref: '#/components/responses/SubscriptionNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/multisim':
    get:
      tags:
        - Multisim
      summary: Search multisim subscriptions
      description: Search multisim subscriptions matching certain criteria. Specific type data is included
      operationId: getMultisimSubscriptionsByProperties
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/OffsetQueryParam'
        - $ref: '#/components/parameters/LimitQueryParam'
        - $ref: '#/components/parameters/LegacyIdQueryParam'
        - $ref: '#/components/parameters/LegacyAccountIdQueryParam'
        - $ref: '#/components/parameters/LegacyBundleIdQueryParam'
        - $ref: '#/components/parameters/AccountIdQueryParam'
        - $ref: '#/components/parameters/MandatoryQueryParam'
        - $ref: '#/components/parameters/StatusQueryParam'
        - $ref: '#/components/parameters/TypeQueryParam'
        - $ref: '#/components/parameters/ActivationDateQueryParam'
        - $ref: '#/components/parameters/DeactivationDateQueryParam'
        - $ref: '#/components/parameters/MsisdnQueryParam'
        - name: main_subscription_id
          in: query
          description: Main subscription identifier. Required if msisdn or main_msisdn are not provided
          required: false
          schema:
            type: string
            format: uuid
          example: 123e4567-e89b-12d3-a456-426614174000
        - name: main_msisdn
          in: query
          description: |
            MSISDN of the main subscription associated to the multisim subscription following E.164 format. 
            Spanish country code is assumed if plus sign(+) is not included to indicate international format. 
            Required if msisdn or main_subscription_id are not provided
          required: true
          schema:
            type: string
          example: +34611223344
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MultisimList'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/operations':
    post:
      tags:
        - Operations
      summary: This endpoint allows to perform administration operations in batch mode via CSV file upload
      description: This endpoint allows to perform administration operations in batch mode via CSV file upload. More detailed documentation can be found [here](https://github.com/masmovil/mm-monorepo/blob/master/pkg/mas-stack/bss/mas-subscriptions/docs/openapi/v2/subscriptions/operations.md)
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
      requestBody:
        required: true
        description: CSV file containing the operations to be performed
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: Document content in binary format
      responses:
        '202':
          description: File processed successfully. This does not mean that all operations were successful, check the response body for details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdministrationOperationResponse'
        '400':
          description: Client error. Possible causes are malformed CSV, invalid operation type, missing required parameters, invalid parameter values.
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

  '/orgs/{org}/subscriptions/{subscriptionId}/devices/{deviceId}/payment_plans':
    get:
      tags:
        - Payment Plans
      summary: Get device payment plan by subscription and device IDs
      description: Returns the payment plan for a specific device in a subscription
      operationId: getSubscriptionDevicePaymentPlans
      parameters:
        - $ref: '#/components/parameters/OrgPathParam'
        - $ref: '#/components/parameters/SubscriptionIdPathParam'
        - $ref: '#/components/parameters/DeviceIdPathParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentPlanList'
        '403':
          $ref: '#/components/responses/ForbiddenAccess'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultErrorResponse'

components:
  schemas:
    Subscription:
      type: object
      required:
        - id
        - type
        - status
        - creation_date
        - creation_system
        - creation_user
        - last_updated_date
        - last_status_update
        - pre_scoring_id
      properties:
        id:
          type: string
          description: Unique identifier of the subscription
          readOnly: true
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
        legacy_id:
          type: integer
          description: Legacy unique identifier of the subscription
          readOnly: true
          example: 54
        pre_scoring_id:
          type: string
          description: |
            A subscriber scoring check is required before bundle creation request and the id returned from
            risk management system must be provided here
          writeOnly: true
          example: "1564"
        type:
          description: |
            Subscription type
          allOf:
            - $ref: '#/components/schemas/SubscriptionType'
        catalogue_commercial_product_id:
          type: string
          description: |
            Commercial product id according to catalogue definition regardless of the bundle the subscription is included in
          example: "7125"
        status:
          description: Subscription status, check https://developers.masstack.com/en/guides/subscriptions/lifecycle for more information
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/LifeCycleStatus'
        promotions:
          type: array
          description: Ids of subscription applicable promotions according to catalogue definition
          writeOnly: true
          items:
            $ref: '#/components/schemas/Promotion'
        add_ons:
          type: array
          description: Ids of subscription applicable add-ons(value added services) according to catalogue definition
          writeOnly: true
          items:
            $ref: '#/components/schemas/AddOn'
        free_units_packages:
          type: array
          description: Ids of free units packages according to catalogue definition
          writeOnly: true
          items:
            $ref: '#/components/schemas/FreeUnitsPackage'
        devices_related_info:
          writeOnly: true
          description: Info about devices associated to the subscription
          allOf:
            - $ref: '#/components/schemas/DevicesRelatedInfo'
        last_status_update:
          type: string
          description: Last status update date and time. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2023-01-05T03:30:15Z
        last_status_reason:
          type: string
          description: |
            Reason for the last status update according to defined values. Check possible values in STATUS/STATUS table
            in https://developers.masstack.com/en/guides/subscriptions/lifecycle.
          readOnly: true
          example: FRAUD_CHECK_ONGOING
        activation_date:
          type: string
          description: |
            Activation date and time, subscription is considered chargeable and available for the user from 
            this time on. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2023-01-01T00:00:00Z
        deactivation_date:
          type: string
          description: |
            Deactivation date and time, subscription is considered cancelled or inactive for the user from this time on.
            Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2025-01-05T03:30:15Z
        legacy_account_id:
          type: integer
          description: Account id the subscription is linked to. Linked to MySim/Apollo storage, to be deprecated.
          example: 245655
          readOnly: true
        account_id:
          type: string
          description: Unique identifier of the account
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
          format: uuid
          readOnly: true
        bundle_related_info:
          $ref: '#/components/schemas/SubscriptionBundleRelation'
        creation_date:
          type: string
          description: Subscription creation date and time. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2022-12-01T00:00:00Z
        creation_system:
          type: string
          description: |
            Info about the system/frontend originating the subscription creation. It contains the mas-stack authentication 
            audience info for mas-stack authenticated subscription creation or N/A for others
          readOnly: true
          example: killflex.auth.masmovil.com
        creation_user:
          type: string
          description: |
            Info about the specific user that requested the subscription creation. It contains the mas-stack 
            authentication subject info for mas-stack authenticated subscription creation, other user info for 
            subscriptions created by legacy systems if available or N/A if not available
          readOnly: true
          example: john.doe@masmovil.com
        last_updated_date:
          type: string
          description: Date and time when any field of the subscription was last updated. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2023-01-08T12:00:05Z
        deactivation_system:
          type: string
          description: |
            Info about the system/frontend originating the subscription deactivation. It contains the mas-stack 
            authentication audience info for mas-stack authenticated deactivation or other user info for legacy systems 
            if available
          readOnly: true
          example: killflex.auth.masmovil.com
        deactivation_user:
          type: string
          description: |
            Info about the specific user that requested the subscription deactivation. It contains the mas-stack 
            authentication subject info for mas-stack authenticated subscription deactivation, other user info for 
            subscriptions created by legacy systems if available or N/A if not available
          readOnly: true
          example: john.doe@masmovil.com
        bundles_history:
          type: array
          description: History of bundles the subscription has been part of
          readOnly: true
          items:
            $ref: '#/components/schemas/SubscriptionBundleHistory'

    LifeCycleStatus:
      type: string
      enum:
        - REQUESTED
        - ON_HOLD
        - PROVISIONING
        - ACTIVE
        - DEACTIVATING
        - DEACTIVATED
        - CANCELLING
        - CANCELLED
      example: ACTIVE

    PromotionStatus:
      type: string
      enum:
        - REQUESTED
        - ACTIVE
        - CANCELLED
        - DEACTIVATED
        - EXPIRED
      example: ACTIVE

    SubscriptionType:
      type: string
      x-extensible-enum:
        - MOBILE
        - BROADBAND
        - LANDLINE
        - TV
        - SECURITY
        - DATA_SHARING
        - MULTISIM
        - DEVICE_INSURANCE
        - NETFLIX
        - APPLE_WATCH
        - AMAZON_PRIME
        - MAX
        - ORANGE_TV
        - DISNEY
      example: NETFLIX
      readOnly: true

    SubscriptionBundleHistory:
      type: object
      properties:
        bundle_id:
          type: string
          description: Unique identifier of the bundle
          readOnly: true
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
          format: uuid
        legacy_bundle_id:
          type: integer
          description: Legacy unique identifier of the bundle
          readOnly: true
          example: 54
        start_date:
          type: string
          description: Date and time when the subscription was added to the bundle. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2022-12-01T00:00:00Z
        end_date:
          type: string
          description: Date and time when the subscription was removed from the bundle. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2023-01-05T03:30:15Z

    DevicesRelatedInfo:
      type: object
      properties:
        devices:
          type: array
          items:
            $ref: '#/components/schemas/Device'
        customer_financial_info:
          $ref: '#/components/schemas/CustomerFinancialInfo'
        pre_booking:
          $ref: '#/components/schemas/PreFinancingBooking'
        delivery_info:
          description: Info to grant delivery of devices
          type: object
          properties:
            contact_info:
              $ref: '#/components/schemas/ContactInfo'
            address:
              $ref: '#/components/schemas/Address'
            delivery_type:
              type: string
              description: Delivery type
              enum:
                - SHOP
                - POST_OFFICE
                - CUSTOMER_ADDRESS
                - UNKNOWN
              example: CUSTOMER_ADDRESS
            dealer_code:
              type: string
              description: Dealer the store is associated to. Required if delivery_type is SHOP
              example: "1234"

    SubscriptionsSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Subscription'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    PaymentPlanStatus:
      type: string
      enum:
        - REQUESTED
        - ON_HOLD
        - ACTIVE
        - DEACTIVATING
        - DEACTIVATED
        - CANCELLING
        - CANCELLED
      example: ACTIVE

    PaymentPlanStatusDetail:
      type: string
      enum:
        - AMORTIZATION_PENDING
        - AMORTIZED
        - CANCELED_BY_AGENT
        - EXPEDITION_CANCELLED
        - FRAUD_CHECK_ONGOING
        - NONE
        - ORDER_CANCELLED
        - PENDING_DEVICE_DELIVERY
        - PENDING_PAYMENT
        - THIRD_PARTY_PENDING
        - WITHDRAWAL_PERIOD
        - WITHDRAWN_BY_CUSTOMER
        - DEVICE_RETURN_OK
        - DEVICE_RETURN_KO
        - DEVICE_RETURN_REQUESTED
      example: AMORTIZATION_PENDING

    PaymentPlan:
      type: object
      required:
        - id
        - status
        - creation_date
        - entity
      properties:
        id:
          type: string
          description: Payment plan unique identifier
          readOnly: true
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
        legacy_id:
          type: integer
          description: Legacy payment plan unique identifier
          readOnly: true
          example: 54
        parent_id:
          type: string
          description: Payment plan unique identifier of the parent payment plan in case of a refinancing
          readOnly: true
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
        parent_legacy_id:
          type: integer
          description: Payment plan unique identifier of the parent payment plan in case of a refinancing
          readOnly: true
          example: 54
        entity:
          type: string
          description: Financial entity supporting the payment plan
          example: "1564"
        status:
          description: Payment plan status
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/PaymentPlanStatus'
        status_detail:
          type: string
          description: Detail for the current status
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/PaymentPlanStatusDetail'
        activation_date:
          type: string
          description: |
            Activation date and time, subscription is considered chargeable and available for the user from 
            this time on. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2023-01-01T00:00:00Z
        deactivation_date:
          type: string
          description: |
            Deactivation date and time, subscription is considered cancelled or inactive for the user from this time on.
            Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2025-01-05T03:30:15Z
        creation_date:
          type: string
          description: Payment plan creation date and time. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2022-12-01T00:00:00Z
        creation_system:
          type: string
          description: |
            Info about the system/frontend originating the subscription creation. It contains the mas-stack authentication 
            audience info for mas-stack authenticated subscription creation or N/A for others
          readOnly: true
          example: killflex.auth.masmovil.com
        creation_user:
          type: string
          description: |
            Info about the specific user that requested the subscription creation. It contains the mas-stack 
            authentication subject info for mas-stack authenticated subscription creation, other user info for 
            subscriptions created by legacy systems if available or N/A if not available
          readOnly: true
          example: john.doe@masmovil.com
        last_updated_date:
          type: string
          description: Date and time when any field of the payment plan was last updated. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2023-01-08T12:00:05Z

    PaymentPlanList:
      items:
        $ref: '#/components/schemas/PaymentPlan'

    Bundle:
      type: object
      required:
        - id
        - catalogue_bundled_product_id
        - pre_scoring_id
        - creation_system
        - creation_user
      properties:
        catalogue_bundled_product_id:
          type: string
          description: Bundled product id according to catalogue definition
          example: 8432
        legacy_account_id:
          type: integer
          description: |
            Account id the subscription is linked to. Required if 'legacy_id' filter is not provided. Linked to 
            MySim/Apollo storage, to be deprecated.
          example: "245655"
        account_id:
          type: string
          description: Unique identifier of the account
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
          format: uuid
        legacy_customer_id:
          type: integer
          writeOnly: true
          description: |
            Customer id the account id is linked to. Required if 'external_sell_id' is not provided. Linked to 
            MySim/Apollo storage, to be deprecated.
          example: "245655"
        dealer_id:
          type: string
          writeOnly: true
          description: |
            Dealer id. Required if 'external_sell_id' is not provided.
          example: "245655"
        financial_evaluation_info:
          writeOnly: true
          allOf:
            - $ref: '#/components/schemas/FinancialEvaluationInfo'
        signature_process_id:
          type: string
          description: Id of the resource containing subscriber valid signature to purchase subscription
          writeOnly: true
          example: 18395
        external_sell_id:
          type: string
          description: Legacy field to relate bundle to external sale operation
          writeOnly: true
          example: 242940268
        purchase_payment:
          writeOnly: true
          allOf:
            - $ref: '#/components/schemas/PaymentData'
        subscriptions:
          writeOnly: true
          allOf:
            - $ref: '#/components/schemas/BundleSubscriptions'
        id:
          type: string
          description: Unique identifier of the subscriptions bundle
          readOnly: true
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
        legacy_id:
          type: integer
          description: Legacy unique identifier of the subscriptions bundle
          readOnly: true
          example: 5345
        status:
          description: |
            Bundle status, check https://developers.masstack.com/en/guides/subscriptions/lifecycle for more information
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/LifeCycleStatus'
        last_status_update:
          type: string
          description: Last status update date and time. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2023-01-05T03:30:15Z
        last_status_reason:
          type: string
          description: |
            Reason for the last status update according to defined values. Check possible values in status table
            in https://developers.masstack.com/en/guides/subscriptions/lifecycle.
          readOnly: true
          example: FRAUD_CHECK_ONGOING
        creation_date:
          type: string
          description: Subscription creation date and time. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2022-12-01T00:00:00Z
        creation_system:
          type: string
          description: |
            Info about the system that requested the bundle creation. It contains the mas-stack authentication audience info
          readOnly: true
          example: killflex.auth.masmovil.com
        creation_user:
          type: string
          description: Info about the specific user that requested the bundle creation
          readOnly: true
          example: john.doe@masmovil.com
        fraud_check_status:
          type: string
          description: Current fraud check status for the bundle creation
          readOnly: true
          enum:
            - APPROVED
            - DENIED
            - UNDER_REVIEW
            - DOCUMENTATION_REQUIRED
          example: APPROVED
        installation_order_id:
          type: string
          description: Id of the installation order related to the bundle
          readOnly: true
          example: "18395"
        contract_id:
          type: string
          description: Id of the contract generated
          readOnly: true
          example: "MMMC2407247403552"
        contract_delivery_channel:
          type: string
          description: Delivery channel used to send the contract
          writeOnly: true
          enum:
            - APPLICATION
            - PAPER
            - EMAIL
            - UNKNOWN
        origin:
          type: string
          description: Bundle process origin
          writeOnly: true
          enum:
            - NEW_SALE
            - CROSS_SELL
            - MIGRATION
            - ADD_SUBSCRIPTION
            - UNKNOWN
          example: NEW_SALE
        app_id:
          type: integer
          description: Application id according to MySim
          writeOnly: true
          example: 4
        activation_date:
          type: string
          description: |
            Activation date and time, bundle is considered chargeable and available for the user from 
            this time on. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2023-01-01T00:00:00Z
        deactivation_date:
          type: string
          description: |
            Deactivation date and time, bundle is considered cancelled or inactive for the user from this time on.
            Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2025-01-05T03:30:15Z

    BundleSubscriptions:
      type: object
      description: Set of subscriptions to include on bundle grouped by type
      properties:
        mobile:
          type: array
          description: Mobile subscriptions included in the bundle
          items:
            $ref: '#/components/schemas/Mobile'
        broadband:
          type: array
          description: Broadband subscriptions included in the bundle
          items:
            $ref: '#/components/schemas/Broadband'
        landline:
          type: array
          description: Landline subscriptions included in the bundle
          items:
            $ref: '#/components/schemas/Landline'
        amazon_prime:
          type: array
          description: Amazon Prime subscriptions included in the bundle
          items:
            $ref: '#/components/schemas/AmazonPrime'
        tv:
          type: array
          description: TV subscriptions included in the bundle
          items:
            $ref: '#/components/schemas/Tv'
        netflix:
          type: array
          description: Netflix subscriptions included in the bundle
          items:
            $ref: '#/components/schemas/Netflix'
        max:
          type: array
          description: Max subscriptions included in the bundle
          items:
            $ref: '#/components/schemas/Max'
        orange_tv:
          type: array
          description: Orange Tv subscriptions included in the bundle
          items:
            $ref: '#/components/schemas/OrangeTv'
        orange_tv_libre:
          type: array
          description: Orange Tv Libre subscriptions included in the bundle
          items:
            $ref: '#/components/schemas/OrangeTvLibre'
        disney:
          type: array
          description: Disney subscriptions included in the bundle
          items:
            $ref: '#/components/schemas/Disney'


    BundlesSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Bundle'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    Landline:
      type: object
      description: Landline subscriptions included in the bundle
      allOf:
        - $ref: '#/components/schemas/Subscription'
        - type: object
      properties:
        specific_data:
          $ref: '#/components/schemas/LandlineSpecificData'

    LandlineSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Landline'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    LandlineSpecificData:
      type: object
      description: Landline subscription including specific info
      required:
        - contact_info
        - fixed_phone_number
      properties:
        fixed_phone_number:
          type: string
          description: Landline fixed phone number
          example: "913312244"
        installation_address:
          description: Indicates the address where the service is installed
          allOf:
            - $ref: '#/components/schemas/Address'
        contact_info:
          description: Contact info of the person that must be contacted for installation process
          allOf:
            - $ref: '#/components/schemas/ContactInfo'
          writeOnly: true
        fixed_portability_info:
          allOf:
            - $ref: '#/components/schemas/FixedPortabilityInfo'
          writeOnly: true

    Broadband:
      type: object
      description: Broadband subscriptions included in the bundle
      allOf:
        - $ref: '#/components/schemas/Subscription'
        - type: object
      properties:
        specific_data:
          $ref: '#/components/schemas/BroadbandSpecificData'

    BroadbandSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Broadband'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    BroadbandSpecificData:
      type: object
      description: Broadband subscription including specific info
      required:
        - territory_owner
      properties:
        access_id:
          type: string
          description: Id that identifies the specific access to the network used by the subscription
          example: IUA-XXX
        vacant_loop:
          type: boolean
          writeOnly: true
          description: Indicates if there is a vacant loop for provision
        territory_owner:
          type: string
          description: Territory owner of the network infrastructure
          example: FIBMM01
        access_reuse_info_allowed:
          type: boolean
          description: Indicates if the client consents the access to installation info for access reuse
          example: true
          writeOnly: true
        legacy_service_id:
          type: string
          description: Legacy service id that identifies the broadband service in OSS
          example: MYSIM_2331123
        installation_address:
          description: Indicates the address where the service is installed
          allOf:
            - $ref: '#/components/schemas/Address'

    Mobile:
      type: object
      allOf:
        - $ref: '#/components/schemas/Subscription'
        - type: object
      properties:
        specific_data:
          $ref: '#/components/schemas/MobileSpecificData'

    MobileSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Mobile'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    MobileSpecificData:
      type: object
      description: Mobile subscription specific info
      required:
        - msisdn
      properties:
        msisdn:
          type: string
          description: MSISDN (Mobile Station International Subscriber Directory Number) formatted following E.164 format
          example: +34611223344
        mobile_portability_info:
          writeOnly: true
          allOf:
            - $ref: '#/components/schemas/MobilePortabilityInfo'
        sim:
          allOf:
            - $ref: '#/components/schemas/Sim'

    Multisim:
      type: object
      description: Multisim subscriptions included in the bundle
      allOf:
        - $ref: '#/components/schemas/Subscription'
        - type: object
      properties:
        specific_data:
          $ref: '#/components/schemas/MultisimSpecificData'

    MultisimList:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Multisim'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    MultisimSpecificData:
      type: object
      description: Multisim subscription including specific info
      required:
        - main_subscription_id
        - msisdn
        - sim
      properties:
        main_subscription_id:
          type: string
          description: Unique identifier of the multisim subscription
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
        msisdn:
          type: string
          description: MSISDN (Mobile Station International Subscriber Directory Number) formatted following E.164 format
          example: +34611223344
        sim:
          allOf:
            - $ref: '#/components/schemas/Sim'

    FinancialEvaluationInfo:
      type: object
      required:
        - credit_limit
        - credit_limit_available
        - pre_scoring_id
      properties:
        credit_limit:
          type: number
          description: Credit limit assigned to the subscriber
          example: 1000
        credit_limit_available:
          type: number
          description: Credit limit available for the subscriber
          example: 1000
        pre_scoring_id:
          type: string
          description: |
            A subscriber scoring check is required before bundle creation and the scoring request id must be provided 
            in this field
          writeOnly: true
          example: 18395
        score_value:
          type: integer
          description: Score value calculated by risk system
          writeOnly: true
          example: 71
        upfront:
          type: number
          description: Upfront calculated by risk system
          example: 0.0

    AmazonPrime:
      type: object
      allOf:
        - $ref: '#/components/schemas/Subscription'
        - type: object
      properties:
        specific_data:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/AmazonPrimeSpecificData'

    AmazonPrimeSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/AmazonPrime'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    AmazonPrimeSpecificData:
      type: object
      description: Amazon Prime subscription specific info
      properties:
        entitlement_id:
          type: string
          description: "Amazon Prime internal ID that identifies the subscription for any required operation to be performed on it, e.g: activate, update, cancel, etc."
          example: "d2af0bd9-c71b-42aa-a258-c9d9dc734bfc"
        product_id:
          type: string
          description: Amazon Prime product ID according to its provided catalog definition, relevant for B2B billing.
          example: PRIME_1M_BUNDLE
        prime_bundle_id:
          type: string
          description: "Amazon Prime internal ID that uniquely identifies the subscription once it has been activated and allows subsequent operations such as info check"
          example: "e773dac9-4b13-4287-bb97-a773200de581"
        bundle_tier:
          type: string
          description: |
            Amazon Prime tier for the subscription according to its internal promotions situation (e.g: free trial),relevant for its B2B billing. Values defined by Amazon
          x-extensible-enum:
            - PRIME_HARD_OFFER
            - PRIME_FT
          example: PRIME_HARD_OFFER

    Max:
      type: object
      allOf:
        - $ref: '#/components/schemas/Subscription'
        - type: object
      properties:
        specific_data:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/MaxSpecificData'

    MaxSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Max'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    MaxSpecificData:
      type: object
      description: Max subscription specific info
      properties:
        service_id:
          type: string
          description: "Max internal ID that identifies the subscription for any required operation to be performed on it, e.g: activate, update, cancel, etc."
          example: "d2af0bd9-c71b-42aa-a258-c9d9dc734bfc"
        product_id:
          type: string
          description: Max product ID according to its provided catalog definition, relevant for B2B billing.
          example: "beam-max-svod-monthly"

    OrangeTv:
      type: object
      allOf:
        - $ref: '#/components/schemas/Subscription'
        - type: object
      properties:
        specific_data:
          allOf:
            - $ref: '#/components/schemas/OrangeTvSpecificData'

    OrangeTvSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/OrangeTv'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    OrangeTvSpecificData:
      type: object
      description: Orange TV subscription specific info
      properties:
        registration_email:
          type: string
          description: Email address linked to the Orange TV subscription
          example: john.doe@mail.com
        service_id:
          type: string
          description: "Orange Tv internal ID that identifies the subscription for any required operation to be performed on it, e.g: activate, update, cancel, etc."
          example: yoigo123456789
          readOnly: true
        product_id:
          type: string
          description: Orange Tv product ID according to its provided catalog definition, relevant for B2B billing.
          example: SP_OFFER_0200000
          readOnly: true

    OrangeTvLibre:
      type: object
      allOf:
        - $ref: '#/components/schemas/Subscription'
        - type: object
      properties:
        specific_data:
          allOf:
            - $ref: '#/components/schemas/OrangeTvLibreSpecificData'

    OrangeTvLibreSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/OrangeTvLibre'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    OrangeTvLibreSpecificData:
      type: object
      description: Orange TV Libre subscription specific info
      properties:
        registration_email:
          type: string
          description: Email address linked to the Orange TV Libre subscription
          example: john.doe@mail.com
        service_id:
          type: string
          description: "Orange Tv Libre internal ID that identifies the subscription for any required operation to be performed on it, e.g: activate, update, cancel, etc."
          example: Yoigo123456789
          readOnly: true
        product_id:
          type: string
          description: Orange Tv Libre product ID according to its provided catalog definition, relevant for B2B billing.
          example: SP_OFFER_0200000
          readOnly: true
        password:
          type: string
          description: Customer password to provide the service
          writeOnly: true

    Disney:
      type: object
      allOf:
        - $ref: '#/components/schemas/Subscription'
        - type: object
      properties:
        specific_data:
          allOf:
            - $ref: '#/components/schemas/DisneySpecificData'

    DisneySet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Disney'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    DisneySpecificData:
      type: object
      description: Disney subscription specific data.
      properties:
        user_id:
          type: string
          description: The provider user identifier.
          example: "d2af0bd9-c71b-42aa-a258-c9d9dc734bfc"
          readOnly: true
        service_id:
          type: string
          description: The provider service identifier.
          example: "d2af0bd9-c71b-42aa-a258-c9d9dc734bfc"
          readOnly: true
        product_id:
          type: string
          description: The provider product identifier.
          example: "com.disney.yoigo.es.bundle.standard"
          readOnly: true

    AgileTv:
      type: object
      allOf:
        - $ref: '#/components/schemas/Subscription'
        - type: object
      properties:
        specific_data:
          allOf:
            - $ref: '#/components/schemas/AgileTvSpecificData'

    AgileTvSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/AgileTv'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    AgileTvSpecificData:
      type: object
      description: AgileTv subscription specific info
      properties:
        product_id:
          type: string
          description: Product identifier from AgileTv provider
          example: "a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6"
        service_id:
          type: string
          description: Service identifier from AgileTv provider
          example: "f6e5d4c3-b2a1-4098-a7b6-c5d4e3f2a1b0"
        is_primary:
          type: boolean
          description: Indicates if this is a primary subscription
          example: true
      required:
        - is_primary

    Tv:
      type: object
      allOf:
        - $ref: '#/components/schemas/Subscription'
        - type: object
      properties:
        specific_data:
          $ref: '#/components/schemas/TvSpecificData'

    TvSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Tv'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    TvSpecificData:
      type: object
      description: TV subscription specific info
      required:
        - registration_email
        - contact_number
        - id_doc
      properties:
        service_id:
          type: string
          description: TV service id that identifies the subscription on the TV provider side
          example: 959608034
        registration_email:
          type: string
          description: Email address linked to the TV subscription
          example: john.doe@mail.com
        technical_installation_required:
          type: boolean
          description: Indicates if a technician visit required for the installation
          example: false
        contact_number:
          type: string
          description: Contact number for the TV subscription
          example: 696288378
        id_doc:
          $ref: '#/components/schemas/IdDoc'

    Netflix:
      type: object
      allOf:
        - $ref: '#/components/schemas/Subscription'
        - type: object
      properties:
        specific_data:
          $ref: '#/components/schemas/NetflixSpecificData'

    NetflixList:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Netflix'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    NetflixSpecificData:
      type: object
      description: Netflix subscription including specific info
      properties:
        service_id:
          type: string
          description: The provider service identifier.
          readOnly: true
          example: "Me7b7b7b7-b7b7-b7b7-b7b7-b7b7b7b7b7b7"
        bundle_id:
          type: string
          description: The provider bundle identifier.
          example: "d2af0bd9-c71b-42aa-a258-c9d9dc734bfc"
          readOnly: true
        product_id:
          type: string
          description: The provider product identifier.
          example: "d2af0bd9-c71b-42aa-a258-c9d9dc734bfc"
          readOnly: true

    DeviceInsurance:
      type: object
      allOf:
        - $ref: '#/components/schemas/Subscription'
        - type: object
      properties:
        specific_data:
          $ref: '#/components/schemas/DeviceInsuranceSpecificData'

    DeviceInsuranceList:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/DeviceInsurance'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    DeviceInsuranceSpecificData:
      type: object
      description: DeviceInsurance subscription including specific info
      properties:
        device_id:
          type: string
          format: uuid
          description: Id of the insured device
          example: "ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39"
        service_id:
          type: string
          description: Policy id generated by the provider
          example: "0819230465"
          readOnly: true

    ContactInfo:
      type: object
      required:
        - name
        - surname
        - id_doc
      properties:
        name:
          type: string
          example: "Juan"
        surname:
          type: string
          example: "Perez Lopez"
        id_doc:
          $ref: '#/components/schemas/IdDoc'
        phone_number:
          type: string
          example: "696288378"
        email_address:
          type: string
          example: "juan@hotmail.com"

    PaymentData:
      type: object
      required:
        - total_amount
        - tax_amount
      properties:
        total_amount:
          type: number
          description: Total amount of the payment
          example: 149.0
        tax_amount:
          type: number
          description: Tax amount of the payment
          example: 10
        first_invoice_payment:
          type: number
          description: First invoice advance payment amount
          example: 5.0
        point_of_sale_payment:
          type: number
          description: Point of sale payment amount
          example: 33.0
        platform:
          type: string
          description: |
            Platform used for the payment
          x-extensible-enum:
            - ADYEN
          example: "ADYEN"
        transaction_id:
          type: string
          description: Transaction ID of the payment
          example: "PLC6640C65E45847BC"
        link:
          type: string
          description: Link to the payment platform
          example: "https://test.adyen.link/PLC6640C65E45847BC"
        external_reference:
          type: string
          description: External reference of the payment
          example: "2311BDXI1880"

    CustomerFinancialInfo:
      type: object
      properties:
        bank_declared_income:
          type: number
          description: Declared income in the bank
          example: 0.0
        business_name:
          type: string
          description: Name of the business
          example: ""
        observations:
          type: string
          description: Observations related to the business
          example: "blabla"
        professional_usage:
          type: boolean
          description: Indicates if the business is used for professional purposes
          example: false
        activity_country:
          type: string
          description: Country where the business activity is conducted
          example: "es"
        doc_expiration_date:
          type: string
          format: date-time
          description: Expiration date of the document. Format according to ISO 8601
          example: "2017-09-15T22:00:00Z"
        profession_code:
          type: string
          description: Code representing the profession
          enum:
            - NO_INFO
            - PRIVATE_SECTOR_WORKER
            - PRIVATE_SECTOR_ADMINISTRATIVE_TECHNICIAN
            - QUALIFIED_TECHNICIAN
            - PRIVATE_SECTOR_DIRECTOR
            - PUBLIC_SECTOR_ADMINISTRATIVE_WORKER_TECHNICIAN
            - PUBLIC_SECTOR_INTERMEDIATE_DIRECTOR
            - HOSPITALITY_EMPLOYEE
            - SELF_EMPLOYED
            - BUSINESSMAN
            - RENTIER
            - SECURITY_WATCHER
            - WAITER_SALESPERSON
            - PUBLIC_SERVANT
            - STUDENT
            - RETIRED
            - UNEMPLOYED
            - OTHER
            - UNKNOWN
          example: "PRIVATE_SECTOR_WORKER"
        funds_origin_code:
          type: string
          description: Code representing the origin of funds
          example: "3RD"
        occupation_sector_code:
          type: string
          description: Code representing the occupation sector
          example: "SERV"

    PreFinancingBooking:
      type: object
      required:
        - order_id
        - financial_entity
        - agreed_commercial_consents
        - agreed_gdpr
        - status
        - granted_amount
        - credit_line_amount
      properties:
        order_id:
          type: string
          description: Order identifier
          example: "123213asdsa"
        authorization_id:
          type: string
          description: Authorization identifier
          example: ""
        financial_entity:
          type: string
          description: Financial entity involved
          enum:
            - MASMOVIL
            - XCF
            - CELETEMLC
            - SABADELL
            - CETELEMLC
            - CETELEM
            - BBVA
            - NONE
            - UNKNOWN
          example: BBVA
        agreed_commercial_consents:
          type: boolean
          description: Indicates if the commercial consents have been agreed
          example: true
        agreed_gdpr:
          type: boolean
          description: Indicates if the GDPR has been agreed
          example: true
        status:
          type: string
          description: Status of the pre-booking
          enum:
            - ACCEPTED
            - REJECTED
        granted_amount:
          type: number
          description: Granted amount in the pre-booking
          example: 100.0
        credit_line_amount:
          type: number
          description: Credit line amount in the pre-booking
          example: 10.0

    Address:
      type: object
      required:
        - street_type
        - street_name
        - house_number
        - city
        - post_code
      properties:
        street_type:
          type: string
          example: "Calle"
        street_name:
          type: string
          example: "Tellez"
        house_number:
          type: string
          example: "12"
        additional_info:
          type: string
          example: "Esc. Dcha 3 C"
        city:
          type: string
          example: "Riaza"
        province:
          type: string
          example: "Segovia"
        country:
          type: string
          example: "es"
        post_code:
          type: string
          example: "40500"
        address_code:
          type: string
          example: "28000010758100012    OA   004C       "
        address_additional_id:
          description: Additional address info to improve the accuracy of feasibility check of access reuse
          type: string
          example: "123443554"
          writeOnly: true

    IdDoc:
      type: object
      description: Identification document
      properties:
        id_type:
          type: string
          enum:
            - NIF
            - PASSPORT
            - CIF
            - NIE
            - UNKNOWN
          example: NIF
        id:
          type: string
          example: "5012341234"

    FixedPortabilityInfo:
      type: object
      required:
        - donor_operator_id
        - internal_portability
        - installation_required
        - donor_data
      properties:
        donor_operator_id:
          type: string
          description: "Donor operator id according to applicable country authority. e.g: Spain -> CNMC (https://numeracionyoperadores.cnmc.es)"
          example: 31
        scheduled_portability_date:
          type: string
          format: date-time
          description: Earliest portability date if the portability must not be done as soon as possible as it would be done by default. Format according to ISO 8601
          example: "2017-09-15T22:00:00Z"
        internal_portability:
          type: boolean
          description: This indicates if the portability is done between operators that share infrastructure
          example: true
        installation_required:
          type: boolean
          description: This indicates if a technician visit to the house is required for installation
          example: false
        donor_data:
          $ref: '#/components/schemas/DonorData'

    MobilePortabilityInfo:
      type: object
      required:
        - donor_operator_id
        - donor_data
        - donor_iccid
      description: Data required to perform mobile portability
      properties:
        donor_operator_id:
          type: string
          description: Donor operator id according to applicable country authority
          example: 31
        donor_data:
          $ref: '#/components/schemas/DonorData'
        portability_process_initial_date:
          type: string
          format: date-time
          description: Initial date of the portability process. Format according to ISO 8601
          example: "2017-09-15T22:00:00Z"
        internal_portability:
          type: boolean
          description: Indicates if the portability is done between operators that share infrastructure
          example: true
        donor_iccid:
          type: string
          description: ICCID of the donor SIM card
          example: "8934000000000000002"
        donor_billing_type:
          type: string
          description: Billing type of the donor
          example: "PREPAY"
        one_time_password_id:
          type: string
          description: One time password process id used for line ownership check
          example: "ee0881ff-6050-43bd-a4b3-b7e8fd0474d9"
          writeOnly: true

    DonorData:
      type: object
      required:
        - name
        - id_doc
      description: Personal data of the owner before portability
      properties:
        name:
          type: string
          description: Person's name
        surname:
          type: string
          description: Person's surname
        second_surname:
          type: string
          description: Person's second surname
        id_doc:
          $ref: '#/components/schemas/IdDoc'

    CreditLimit:
      type: object
      description: Credit limit subscription information
      required:
        - type
        - value
      properties:
        type:
          type: string
          description: Credit limit type
          enum:
            - ORANGE_TV_TOTAL_CREDIT_LIMIT
            - MOBILE_SUBSCRIPTION_TOTAL_CREDIT_LIMIT
            - MOBILE_SUBSCRIPTION_ROAMING_VOICE_CREDIT_LIMIT
            - MOBILE_SUBSCRIPTION_PREMIUM_CREDIT_LIMIT
            - MOBILE_SUBSCRIPTION_INTERNATIONAL_VOICE_CREDIT_LIMIT
            - LANDLINE_SUBSCRIPTION_TOTAL_CREDIT_LIMIT
            - LANDLINE_SUBSCRIPTION_PREMIUM_CREDIT_LIMIT
            - LANDLINE_SUBSCRIPTION_INTERNATIONAL_VOICE_CREDIT_LIMIT
          example: ORANGE_TV_TOTAL_CREDIT_LIMIT
        value:
          type: number
          description: Credit limit value
          example: 1000.0
        last_updated_user:
          type: string
          description: User that last updated the credit limit
          example: "john.doe@masorange.es"
          readOnly: true
        last_updated_date:
          type: string
          description: Date and time when the credit limit was last updated. Format according to ISO 8601
          format: date-time
          example: 2023-01-08T12:00:05Z
          readOnly: true

    CreditLimitSet:
      type: array
      items:
        $ref: '#/components/schemas/CreditLimit'

    Device:
      type: object
      description: Devices associated to the subscription
      required:
        - catalogue_commercial_device_id
        - legacy_account_id
      properties:
        id:
          type: string
          format: uuid
          description: Device unique identifier
          example: "ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39"
          readOnly: true
        legacy_id:
          type: integer
          description: Legacy unique identifier of the device associated with the subscription
          example: 756402
          readOnly: true
        catalogue_commercial_device_id:
          type: string
          description: "Commercial device id according to catalogue definition"
          example: "CDCVPU_150f5badaa706651e67c59061d373d7e7e"
        catalogue_device_id:
          type: string
          description: "Device id according to catalogue definition"
          readOnly: true
          example: "P09712MRC"
        reservation_id:
          type: string
          description: "Id for device reservation"
          writeOnly: true
          example: "1567"
        signature_process_id:
          type: string
          description: Id of the resource containing subscriber valid signature to purchase device
          writeOnly: true
          example: "18395"
        shipping_order_id:
          type: string
          description: "Id of the shipping order related to the device according to logistic"
          example: "18395"
          readOnly: true
        pickup_order_id:
          type: string
          description: "Id of the pickup order related to the device according to reverse logistic"
          example: "P0000001"
          readOnly: true
        in_store_delivery_date:
          type: string
          description: In shop delivery date to the customer. Format according to ISO 8601.
          readOnly: true
          format: date-time
          example: 2025-01-05T03:30:15Z
        in_store_returned_date:
          type: string
          description: In shop returned date. Format according to ISO 8601.
          readOnly: true
          format: date-time
          example: 2025-01-05T03:30:15Z
        manufacturing_info:
          type: object
          properties:
            id_type:
              type: string
              description: |
                Manufacturing id type
              x-extensible-enum:
                - SERIAL_NUMBER
                - MAC
                - IMEI
              example: SERIAL_NUMBER
            id:
              type: string
              description: Unique id for specific device
              example: 9876543-AB-345
          deprecated: true
        serial_number:
          type: string
          description: The serial number or any alphanumeric identifier of a particular device
          example: 9876543-AB-345
        mac_address:
          type: string
          description: A unique identifier assigned to the device network interface controller
          example: 00-B0-D0-63-C2-26
        imei:
          type: string
          description: The International Mobile Equipment Identity of the device
          example: AA-BBBBBB-CCCCCC-D
        acquisition_type:
          type: string
          description: Specifies the type of acquisition for the device
          enum:
            - BORROWED
            - FINANCED
            - ONE_TIME_PAYMENT
          example: BORROWED
          readOnly: true
        commitments:
          type: array
          items:
            $ref: '#/components/schemas/Commitment'
        insurable_amount:
          type: number
          description: The insurable value of the device, representing the maximum coverage amount for insurance purposes. A null value indicates that the device is not insurable
          example: 135.49
        status:
          description: |
            Device status derived from Apollo terminal and return data.
            See https://developers.masstack.com/en/guides/subscriptions/device-status for enum semantics and
            Device Insurance validation behavior.
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/DeviceStatus'
        legacy_account_id:
          type: integer
          description: |
            Account ID associated with the subscription. Currently tied to MySim/Apollo storage.
          example: "245655"
          readOnly: true
    DeviceStatus:
      type: string
      description: |
        Status of a device associated with a subscription.
        - `ACTIVE`: Device is currently valid for the subscription.
        - `CANCELLED`: Device was cancelled or desisted in legacy Apollo; includes `STATUSID` 49 and 127.
        - `RETURNED`: Device is known as returned.
        - `UNKNOWN`: Device state cannot be safely inferred.
        For Device Insurance, only `CANCELLED` is rejected by status validation; every other status continues to
        catalogue, duplicate insurance, and feasibility validations.
      enum:
        - ACTIVE
        - CANCELLED
        - RETURNED
        - UNKNOWN
      example: ACTIVE
    DevicesSet:
      type: array
      items:
        $ref: '#/components/schemas/Device'

    Sim:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          description: |
            SIM type
          x-extensible-enum:
            - SIM
            - MICROSIM
            - ESIM
            - NANOSIM
          example: ESIM
        iccid:
          type: string
          description: ICCID(Integrated Circuit Card ID) that identifies the SIM and is visible for the customer
          example: "12341234123412341234123412341234"
        imsi:
          type: number
          description: IMSI(international Mobile Subscriber Identity) that identifies the SIM in GSM network
          readOnly: true
          example: 215051234512345

    SubscriptionBundleRelation:
      type: object
      required:
        - id
        - catalogue_bundled_commercial_product_id
        - mandatory
      properties:
        id:
          readOnly: true
          type: string
          description: Unique identifier of the bundle the subscription is included in
          example: abcf20cb-35df-4ffe-bca6-c0ed0c28cb00
        legacy_id:
          readOnly: true
          type: integer
          description: Legacy unique identifier of the bundle the subscription is included in
          example: 790224234
        catalogue_bundled_product_id:
          type: string
          description: Bundle product id according to catalogue definition
          example: "8342"
        catalogue_bundled_commercial_product_id:
          type: string
          description: Bundle commercial product id associated to subscription according to catalogue definition
          example: 8432_BUNDLED_3P
        mandatory:
          type: boolean
          description: Specifies if subscription is mandatory to keep the associated bundle
          example: true

    Commitment:
      type: object
      required:
        - id
      properties:
        id:
          type: string
          format: uuid
          description: Acquired commitment id
          readOnly: true
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
        legacy_id:
          type: integer
          description: Legacy id for acquired commitment linked MySim/Apollo storage, to be deprecated but required when catalogue_term_id not available
          readOnly: true
          example: 345
        expiration_date:
          type: string
          description: End date according to ISO 8601
          readOnly: true
          format: date-time
          example: 2025-01-05T03:30:15Z
        cancellation_date:
          type: string
          description: Cancellation date according to ISO 8601
          readOnly: true
          format: date-time
          example: 2025-02-13T10:35:05Z
        cancellation_system:
          type: string
          description: Info about the system that requested the commitment cancellation. It contains the mas-stack authentication audience info.  N/A if not available
          readOnly: true
          example: killflex.auth.masmovil.com
        cancellation_user:
          type: string
          readOnly: true
          description: Info about the specific user that requested the commitment cancellation. N/A if not available
          example: john.doe@masorange.es

    Contract:
      type: object
      required:
        - id
        - documents_contract_id
        - documents_owner_id
      properties:
        id:
          type: string
          format: uuid
          description: Contract id
          readOnly: true
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
        documents_contract_id:
          type: string
          description: Documents service contract id
          example: 12345678-1234-1234-1234-123456789012
        documents_owner_id:
          type: string
          description: Documents service owner id
          writeOnly: true
          example: 87654321-4321-4321-4321-210987654321
        creation_date:
          type: string
          description: Creation date according to ISO 8601
          readOnly: true
          format: date-time
          example: 2025-01-05T03:30:15Z
        creation_user:
          type: string
          description: User who created the contract
          readOnly: true
          example: john.doe@masorange.es
        creation_system:
          type: string
          description: System that created the contract
          readOnly: true
          example: mas-subscriptions.auth.masmovil.com
        last_updated_date:
          type: string
          description: Last update date according to ISO 8601
          readOnly: true
          format: date-time
          example: 2025-01-06T10:30:15Z
        last_updated_user:
          type: string
          description: User who last updated the contract
          readOnly: true
          example: jane.smith@masorange.es

    ContractsSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Contract'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    Promotion:
      type: object
      required:
        - id
        - catalogue_promotion_id
        - creation_date
        - creation_system
        - creation_user
        - last_updated_date
        - status
      properties:
        id:
          type: string
          description: Promotion ID
          readOnly: true
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
        legacy_id:
          type: integer
          description: Legacy promotion ID
          readOnly: true
          example: 457345
        catalogue_promotion_id:
          type: string
          description: Catalogue promotion ID
          example: "124"
        commitments:
          type: array
          readOnly: true
          items:
            $ref: '#/components/schemas/Commitment'
        creation_date:
          type: string
          description: Promotion creation date. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2022-12-01T00:00:00Z
        creation_system:
          type: string
          description: Info about the system that requested the promotion creation. It contains the mas-stack authentication audience info.  N/A if not available
          readOnly: true
          example: killflex.auth.masmovil.com
        creation_user:
          type: string
          readOnly: true
          description: Info about the specific user that requested the promotion creation. N/A if not available
          example: john.doe@masorange.es
        last_updated_date:
          type: string
          description: Date and time when any field of the promotion was last updated. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2023-01-08T12:00:05Z
        status:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/PromotionStatus'
          type: string
        status_detail:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/PromotionStatusDetail'
          type: string
        activation_date:
          type: string
          description: Activation date and time the promotion is or will be available in the subscription. When provided, it is restricted to be between current billing cycle and less than a year from now. Format according to ISO 8601
          format: date-time
          example: 2023-01-01T00:00:00Z
        expiration_date:
          type: string
          description: The date and time when the promotion expires. Format according to ISO 8601.
          readOnly: true
          format: date-time
          example: 2025-01-05T03:30:15Z
        deactivation_date:
          type: string
          description: |
            Deactivation date and time, promotion is considered cancelled or inactive for the user from this time on.
            Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2025-01-05T03:30:15Z
        deactivation_system:
          type: string
          description: |
            Info about the system that requested the promotion deactivation. It contains the mas-stack authentication
            audience info when deactivation is requested by mas-stack authenticated user, N/A for legacy systems created
            promotions
          readOnly: true
          example: killflex.auth.masmovil.com
        deactivation_user:
          type: string
          description: |
            Info about the specific user that requested the promotion deactivation. It contains the mas-stack authentication
            subject info when deactivation was requested by mas-stack authenticated user, other user info for legacy 
            systems deactivations if available or N/A otherwise
          readOnly: true
          example: john.doe@masorange.es
        origin:
          type: string
          description: Promotion process origin. If not provided, it will be set to EXISTING_CLIENT by default
          writeOnly: true
          enum:
            - MIGRATION
            - EXISTING_CLIENT
            - UNKNOWN
          example: EXISTING_CLIENT

    PromotionsSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Promotion'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    PromotionStatusHistory:
      type: object
      required:
        - status
        - start_date
      properties:
        status:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/PromotionStatus'
          type: string
        start_date:
          type: string
          description: Date and time when the promotion entered this status. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2023-01-01T00:00:00Z
        end_date:
          type: string
          description: Date and time when the promotion changed to another status. Null when this is the current status. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2023-02-01T00:00:00Z

    PromotionStatusHistorySet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/PromotionStatusHistory'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    FreeUnitsPackage:
      type: object
      required:
        - id
        - catalogue_free_units_packages_id
        - activation_date
      properties:
        id:
          type: string
          description: Assigned Free Units Package ID
          readOnly: true
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
        legacy_id:
          type: integer
          description: Assigned Free Units Package legacy ID
          readOnly: true
          example: 457345
        catalogue_free_units_packages_id:
          type: string
          description: Catalogue free units packages ID
          example: "124"
        activation_date:
          type: string
          description: Activation date and time of the package. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2023-01-01T00:00:00Z
        deactivation_date:
          type: string
          description: Deactivation date and time of the package. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2025-01-05T03:30:15Z

    FreeUnitsPackagesSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/FreeUnitsPackage'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object
    AddOn:
      type: object
      required:
        - id
        - catalogue_add_on_legacy_id
        - catalogue_add_on_id
        - creation_date
        - creation_system
        - creation_user
        - last_updated_date
        - status
      properties:
        id:
          type: string
          description: Add-on unique identifier
          readOnly: true
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
        legacy_id:
          type: integer
          description: Legacy add-on id Linked to MySim/Apollo storage, to be deprecated.
          readOnly: true
          example: 457345
        catalogue_add_on_legacy_id:
          type: string
          description: MySim/Apollo related id for the Add-On catalogue resource definition
          example: "124"
        catalogue_add_on_id:
          type: string
          description: Catalogue add-on ID
          example: "124"
        creation_date:
          type: string
          description: add-on creation date. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2022-12-01T00:00:00Z
        creation_system:
          type: string
          description: Info about the system that requested the addOn creation. It contains the mas-stack authentication audience info.  N/A if not available
          readOnly: true
          example: killflex.auth.masmovil.com
        creation_user:
          type: string
          readOnly: true
          description: Info about the specific user that requested the addON creation. N/A if not available
          example: john.doe@masorange.es
        last_updated_date:
          type: string
          description: Date and time when any field of the addOn was last updated. Format according to ISO 8601
          readOnly: true
          format: date-time
          example: 2023-01-08T12:00:05Z
        status:
          type: string
          description: |
            add-on status
          enum:
            - REQUESTED
            - ACTIVE
            - CANCELLED
            - DEACTIVATED
            - PROVISIONING
          readOnly: true
          example: "CANCELLED"
        activation_date:
          type: string
          format: date-time
          readOnly: true
          example: "2023-01-01T00:00:00Z"
        deactivation_date:
          type: string
          format: date-time
          example: "2025-01-05T03:30:15Z"
          readOnly: true
        deactivation_system:
          type: string
          example: "killflex.auth.masmovil.com"
          readOnly: true
        deactivation_user:
          type: string
          description: |
            Info about the specific user that requested the addOn deactivation. It contains the mas-stack authentication
            subject info when deactivation was requested by mas-stack authenticated user, other user info for legacy 
            systems deactivations if available or N/A otherwise
          readOnly: true
          example: john.doe@masorange.es
        provider_product_id:
          type: string
          description: External provider product identifier
          readOnly: true
          example: "provider_product_id"
        provider_service_id:
          type: string
          description: External provider service identifier
          readOnly: true
          example: "d2af0bd9c71b42aaa258c9d9dc734bfc"

    AddOnsSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/AddOn'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetails'

    ErrorDetails:
      type: object
      required:
        - code
        - message
        - reference
      properties:
        code:
          type: string
          description: Error code having an entry in a domain dictionary
          example: FORBIDDEN_ORGANIZATION
        message:
          type: string
          description: Message of the error
          example: "Access to organization not allowed"
        reference:
          type: string
          description: Domain error dictionary location in the developer portal
          default: https://developers.masstack.com/en/guides/subscriptions/errorcatalogue

    PaginationData:
      type: object
      required:
        - limit
        - offset
        - total
      properties:
        limit:
          type: integer
          description: Limit of items per response
          example: 5
        offset:
          type: integer
          description: Limit of items per response
          example: 15
        total:
          type: integer
          description: Total number of results for search criteria
          example: 33

    OperationsSet:
      type: array
      items:
        $ref: '#/components/schemas/Operation'

    Operation:
      type: object
      required:
        - op
      properties:
        op:
          type: string
          description: Operation to be performed between specific options inspired by IETF RFC6902 (https://datatracker.ietf.org/doc/html/rfc6902)
          enum:
            - add
            - replace
            - activate
            - deactivate
            - cancel
            - migrate
          example: "add"
        path:
          type: string
          description: Path to the field to be updated
          example: "/status"
        value:
          type: object
          description: Value to use for the operation, any could be applicable
          example: "DEACTIVATED"
        reason:
          type: string
          description: Additional info about the reason why the operation is requested. Possible values described as "Status Change Reasons" at https://developers.masstack.com/en/guides/subscriptions/lifecycle
          example: "SUBSCRIBER_REQUESTED"

    SubscriptionStatusFilterEnum:
      type: object
      properties:
        eq:
          allOf:
            - $ref: '#/components/schemas/LifeCycleStatus'
          description: Filter by exact status
        in:
          type: array
          items:
            $ref: '#/components/schemas/LifeCycleStatus'
          description: Filter by multiple statuses

    PromotionStatusFilterEnum:
      type: object
      properties:
        eq:
          allOf:
            - $ref: '#/components/schemas/PromotionStatus'
          description: Filter by exact status
        in:
          type: array
          items:
            $ref: '#/components/schemas/PromotionStatus'
          description: Filter by multiple statuses

    DateFilterEnum:
      type: object
      properties:
        eq:
          type: string
          format: date-time
        lt:
          type: string
          format: date-time
        lte:
          type: string
          format: date-time
        gt:
          type: string
          format: date-time
        gte:
          type: string
          format: date-time

    SubscriptionDeactivationRequest:
      type: object
      required:
        - reason
      properties:
        reason:
          type: string
          enum:
            - ACCOUNT_MIGRATION
            - BUNDLE_CANCELLATION
            - BUNDLE_DEACTIVATION
            - BUNDLE_MIGRATION
            - FRAUD_CHECK_REJECTION
            - NON_PAYMENT
            - OTHER
            - PAYMENT_ERROR
            - PROVISIONING_ISSUE
            - SUBSCRIBER_RESIGNATION
            - DEACTIVATED_ON_THIRD_PARTY
            - AUTOMATICALLY_REMOVED
          description: Reason for the deactivation
          example: "SUBSCRIBER_RESIGNATION"
        promotion_commitments_to_cancel:
          type: array
          description: Promotion commitment IDs to cancel in the deactivation process
          items:
            type: string
            format: uuid
          example: [ "ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39" ]
        device_commitments_to_cancel:
          type: array
          description: Device commitment IDs to cancel in the deactivation process
          items:
            type: string
            format: uuid
          example: [ "ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39" ]
        add_on_commitments_to_cancel:
          type: array
          description: Add-on commitment IDs to cancel in the deactivation process
          items:
            type: string
            format: uuid
          example: [ "ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39" ]

    PromotionTerminationRequest:
      type: object
      required:
        - reason
      properties:
        reason:
          type: string
          enum:
            - AUTOMATICALLY_REMOVED
            - MANUALLY_REMOVED
            - OTHER
            - PROMOTION_INCOMPATIBILITY
            - SUBSCRIPTION_DEACTIVATION
          description: Reason for the cancellation/deactivation
          example: "SUBSCRIPTION_DEACTIVATION"

    PromotionStatusDetail:
      type: string
      enum:
        - AUTOMATICALLY_ADDED
        - AUTOMATICALLY_REMOVED
        - BUNDLE_SALE
        - MANUALLY_ADDED
        - MANUALLY_REMOVED
        - OTHER
        - PROMOTION_INCOMPATIBILITY
        - SUBSCRIPTION_ADDED_TO_BUNDLE
        - SUBSCRIPTION_DEACTIVATION
      description: Detail for the promotion current status
      example: "SUBSCRIPTION_DEACTIVATION"

    SubscriptionActivationRequest:
      type: object
      properties:
        activation_date:
          type: string
          format: date-time
          description: Date and time when the subscription is activated. Format according to ISO 8601
          example: "2023-01-01T00:00:00Z"
    ChangeRequestSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/ChangeRequest'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    ChangeRequest:
      type: object
      required:
        - reason
        - specific_data
      properties:
        id:
          type: string
          readOnly: true
          description: Change request unique identifier
          example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39
        type:
          description: Change request type
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ChangeRequestType'
        status:
          description: Change request status
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ChangeRequestStatus'
        date_scheduled:
          type: string
          format: date-time
          description: Date and time when the change request is scheduled to be executed. Format according to ISO 8601
          example: "2023-01-01T00:00:00Z"
        parent_change_request:
          type: string
          readOnly: true
          description: Parent change request id
          example: "ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39"
        reason:
          type: string
          description: Reason for the change request
          enum:
            - SUBSCRIBER_REQUESTED
          example: "SUBSCRIBER_REQUESTED"
        request_user:
          type: string
          description: User that requested the change
          readOnly: true
          example: "asd@asd.com"
        request_system:
          type: string
          description: System that requested the change
          readOnly: true
          example: killflex.auth.masmovil.com

    SubscriptionDeactivationChangeRequest:
      type: object
      required:
        - specific_data
      allOf:
        - $ref: '#/components/schemas/ChangeRequest'
        - type: object
      properties:
        specific_data:
          allOf:
            - $ref: '#/components/schemas/SubscriptionDeactivationRequest'

    SubscriptionDeactivationChangeRequestSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/SubscriptionDeactivationChangeRequest'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    EmailChangeRequest:
      type: object
      required:
        - specific_data
      allOf:
        - $ref: '#/components/schemas/ChangeRequest'
        - type: object
      properties:
        specific_data:
          allOf:
            - $ref: '#/components/schemas/EmailChangeRequestSpecificData'

    EmailChangeRequestSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/EmailChangeRequest'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    EmailChangeRequestSpecificData:
      type: object
      description: Specific data for the email change request
      required:
        - registration_email
      properties:
        registration_email:
          type: string
          description: New email address that will be linked to the subscription
          example: "newemail@test.com"

    TariffChangeRequest:
      type: object
      required:
        - specific_data
      allOf:
        - $ref: '#/components/schemas/ChangeRequest'
        - type: object
      properties:
        specific_data:
          allOf:
            - $ref: '#/components/schemas/TariffChangeRequestSpecificData'

    TariffChangeRequestSet:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/TariffChangeRequest'
      allOf:
        - $ref: '#/components/schemas/PaginationData'
        - type: object

    TariffChangeRequestSpecificData:
      type: object
      description: Specific data for the tariff change request
      properties:
        catalogue_bundled_commercial_product_id:
          type: string
          description: Bundle commercial product id according to catalogue definition that will be applied in the tariff change
          example: 8432_BUNDLED_3P
        catalogue_promotion_ids:
          type: array
          description: Array of both mandatory and optional promotion ids to be applied in the tariff change
          items:
            type: string
          example: [ "124", "125" ]

    SubscriptionCancellationRequest:
      type: object
      description: Cancellation request
      required:
        - reason
      properties:
        reason:
          type: string
          enum:
            - ACCOUNT_MIGRATION
            - BUNDLE_CANCELLATION
            - BUNDLE_DEACTIVATION
            - BUNDLE_MIGRATION
            - FRAUD_CHECK_REJECTION
            - EXPEDITION_CANCELLED
            - OTHER
            - PAYMENT_ERROR
            - PROVISIONING_ISSUE
            - SUBSCRIBER_RESIGNATION
            - AUTOMATICALLY_REMOVED
          description: Reason for the cancellation request
          example: "SUBSCRIBER_RESIGNATION"

    SubscriptionAddOnDeactivationRequest:
      type: object
      required:
        - reason
      properties:
        reason:
          type: string
          enum:
            - SUBSCRIBER_RESIGNATION
          description: Reason for the deactivation
          example: "SUBSCRIBER_RESIGNATION"

    ChangeRequestType:
      type: string
      enum:
        - TARIFF
        - DEACTIVATION
        - EMAIL
      example: TARIFF

    ChangeRequestStatus:
      type: string
      enum:
        - REQUESTED
        - ON_HOLD
        - IN_PROGRESS
        - FINISHED
        - FAILED
        - CANCELED
      example: REQUESTED

    BatchOperationSummary:
      type: object
      properties:
        total:
          type: integer
          example: 100
        success:
          type: integer
          example: 95
        failed:
          type: integer
          example: 5
      required:
        - total
        - success
        - failed

    BatchOperationResult:
      type: object
      properties:
        line:
          type: integer
          example: 1
        operation:
          type: string
          example: "CREATE"
        status:
          type: string
          enum:
            - SUCCESS
            - FAILED
          example: "SUCCESS"
        error:
          type: string
          nullable: true
          example: "Entity not found"
      required:
        - line
        - operation
        - status

    AdministrationOperationResponse:
      type: object
      properties:
        summary:
          $ref: '#/components/schemas/BatchOperationSummary'
        results:
          type: array
          items:
            $ref: '#/components/schemas/BatchOperationResult'
      required:
        - summary
        - results

    ContractDocument:
      type: object
      description: Contract document information
      properties:
        url_expiration_date:
          type: string
          format: date-time
          description: Expiration date of the public URL
          example: 2023-01-27T03:44:52.000Z
        public_url:
          type: string
          description: Public URL to access the document
          example: https://storage.googleapis.com/mas-documents-prod/cbd2e693-d71a-4cee-8313-1972acc0394d
        media_type:
          type: string
          description: Media type of the document
          example: application/pdf
        name:
          type: string
          description: Name of the document
          example: my_doc_name
        documents_contract_id:
          type: string
          description: Unique identifier of the documents contract
          example: a570614e-8a66-4d93-b329-7a2c9d6f0ce8

    ContractDocumentsSet:
      type: object
      description: Set of contract documents
      properties:
        documents:
          type: array
          items:
            $ref: '#/components/schemas/ContractDocument'

  responses:
    DefaultErrorResponse:
      description: Any client or server error
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          example:
            code: ERROR_CODE
            message: Error message
            reference: https://developers.masstack.com/en/guides/subscriptions/errorcatalogue
    SubscriptionNotFound:
      description: A subscription with the specified id was not found
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          example:
            code: SUBSCRIPTION_NOT_FOUND
            message: No subscription found with given id
            reference: https://developers.masstack.com/en/guides/subscriptions/errorcatalogue
    BundleNotFound:
      description: A bundle with the specified id was not found
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          example:
            code: BUNDLE_NOT_FOUND
            message: No bundle found with given id
            reference: https://developers.masstack.com/en/guides/subscriptions/errorcatalogue
    PromotionNotFound:
      description: A promotion with the specified id was not found
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          example:
            code: PROMOTION_NOT_FOUND
            message: No promotion found with given id
            reference: https://developers.masstack.com/en/guides/subscriptions/errorcatalogue
    DeviceNotFound:
      description: A device with the specified id was not found
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          example:
            code: DEVICE_NOT_FOUND
            message: No device found with given id
            reference: https://developers.masstack.com/en/guides/subscriptions/errorcatalogue
    ChangeRequestNotFound:
      description: A change request with the specified id was not found
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          example:
            code: CHANGE_REQUEST_NOT_FOUND
            message: No change request found with given id
            reference: https://developers.masstack.com/en/guides/subscriptions/errorcatalogue
    CommitmentNotFound:
      description: A commitment with the specified id was not found
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          example:
            code: COMMITMENT_NOT_FOUND
            message: No commitment found with given id
            reference: https://developers.masstack.com/en/guides/subscriptions/errorcatalogue
    AddOnNotFound:
      description: AddOn with the specified id was not found
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          example:
            code: ADD_ON_NOT_FOUND
            message: No addOn found with given id
            reference: https://developers.masstack.com/en/guides/subscriptions/errorcatalogue
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: INVALID_REQUEST
            message: The request is invalid
            reference: https://developers.masstack.com/en/guides/subscriptions/errorcatalogue
    ForbiddenAccess:
      description: Forbidden access
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          example:
            code: FORBIDDEN_ORGANIZATION
            message: Access to organization not allowed
            reference: https://developers.masstack.com/en/guides/subscriptions/errorcatalogue
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          example:
            code: DATABASE_ACCESS_ERROR
            message: The database is not accessible
            reference: https://developers.masstack.com/en/guides/subscriptions/errorcatalogue
    SubscriptionConflict:
      description: Subscription was modified by another process. Concurrent modification detected.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          example:
            code: CONFLICT
            message: Subscription was modified by another process. Please retry.
            reference: https://developers.masstack.com/en/guides/subscriptions/errorcatalogue
    ChangeRequestConflict:
      description: A change request for the subscription with the change requested is still in progress
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          example:
            code: CHANGE_REQUEST_CONFLICT
            message: A change request for the subscription with the change requested is still in progress
            reference: https://developers.masstack.com/en/guides/subscriptions/errorcatalogue
    UnsupportedSubscriptionType:
      description: The subscription type requested is not supported
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          example:
            code: UNSUPPORTED_SUBSCRIPTION_TYPE
            message: The requested subscription type is not supported
            reference: https://developers.masstack.com/en/guides/subscriptions/errorcatalogue

  parameters:
    OrgPathParam:
      in: path
      name: org
      description: Organization name
      required: true
      schema:
        type: string
      example: yoigo

    BundleIdPathParam:
      in: path
      name: bundleId
      description: Bundle identifier
      required: true
      schema:
        type: string
        format: uuid
      example: 7a15e304-c357-449b-bd58-bcfb43b3471d

    SubscriptionIdPathParam:
      in: path
      name: subscriptionId
      description: Subscription unique identifier
      required: true
      schema:
        type: string
        format: uuid
      example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39

    OriginUserHeaderParam:
      in: header
      name: x-auth-origin-sub
      schema:
        type: string

    OriginSystemHeaderParam:
      in: header
      name: x-auth-origin-aud
      schema:
        type: string

    PromotionIdPathParam:
      in: path
      name: promotionId
      description: Promotion unique identifier
      required: true
      schema:
        type: string
        format: uuid
      example: 27cdbb91-e380-4f83-a45f-94bf67400342

    CommitmentIdPathParam:
      in: path
      name: commitmentId
      description: Commitment unique identifier
      required: true
      schema:
        type: string
        format: uuid
      example: 00a96051-bb4a-498c-adab-95b1dd8e7222

    DeviceIdPathParam:
      in: path
      name: deviceId
      description: Device unique identifier
      required: true
      schema:
        type: string
        format: uuid
      example: fd2fcd90-2218-4ef1-917b-7ce5f35eee1c

    ChangeRequestIdPathParam:
      in: path
      name: changeRequestId
      description: Change request unique identifier
      required: true
      schema:
        type: string
        format: uuid
      example: 0100cfa5-06e9-4572-976d-5287916adff1

    AddOnIdPathParam:
      in: path
      name: addonId
      description: AddOn unique identifier
      required: true
      schema:
        type: string
        format: uuid
      example: 0100cfa5-06e9-4572-976d-5287916adff1

    ContractIdPathParam:
      in: path
      name: contractId
      description: Contract unique identifier
      required: true
      schema:
        type: string
        format: uuid
      example: a570614e-8a66-4d93-b329-7a2c9d6f0ce8

    LegacyIdQueryParam:
      in: query
      name: legacy_id
      description: Resource legacy ID
      required: false
      schema:
        type: integer
      example: 0

    OffsetQueryParam:
      in: query
      name: offset
      description: Pagination offset
      required: false
      schema:
        type: integer
      example: 0

    LimitQueryParam:
      in: query
      name: limit
      description: Pagination limit
      required: false
      schema:
        type: integer
      example: 50

    LegacyAccountIdQueryParam:
      name: legacy_account_id
      in: query
      description: Account id the subscription is linked to. Required if the legacy_id, account_id, or legacy_bundle_id filters are not provided. Linked to MySim/Apollo storage, to be deprecated.
      required: false
      schema:
        type: integer
      example: 572234234

    LegacyBundleIdQueryParam:
      name: legacy_bundle_id
      in: query
      description: Bundle id the subscription is linked to. Required if the 'legacy_id', 'account_id', or 'legacy_account_id' filters are not provided. Linked
        to MySim/Apollo storage, to be deprecated.
      required: false
      schema:
        type: integer
      example: 26245435

    BundleIdQueryParam:
      name: bundle_id
      in: query
      description: Bundle id the subscription is linked to.
      required: false
      schema:
        type: string
        format: uuid
      example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39

    LegacyAddOnIdQueryParam:
      name: legacy_add_on_id
      in: query
      description: AddOn id the subscription is linked to. Linked to MySim/Apollo storage, to be deprecated.
      required: false
      schema:
        type: integer
      example: 572234234

    AccountIdQueryParam:
      name: account_id
      in: query
      description: Account id the subscription is linked to. Required if the 'legacy_id', 'legacy_account_id', or 'legacy_bundle_id' filters are not provided.
      required: false
      schema:
        type: string
      example: ce2f20cb-35df-4ffe-bca6-c0ed0c28cb39

    MandatoryQueryParam:
      name: mandatory
      in: query
      description: Mandatory subscription filter
      required: false
      schema:
        type: boolean
      example: true

    StatusQueryParam:
      name: status
      in: query
      required: false
      description: Subscription status filter
      style: deepObject
      explode: true
      schema:
        $ref: '#/components/schemas/SubscriptionStatusFilterEnum'

    PromotionStatusQueryParam:
      name: status
      in: query
      required: false
      description: Subscription status filter
      style: deepObject
      explode: true
      schema:
        $ref: '#/components/schemas/PromotionStatusFilterEnum'

    TypeQueryParam:
      name: type
      in: query
      required: false
      description: Subscription type
      schema:
        $ref: '#/components/schemas/SubscriptionType'

    ActivationDateQueryParam:
      name: activation_date
      in: query
      description: |
        Resource activation date filter. Available filters are [eq, lt, lte, gt, gte]. Format according to ISO 8601
      required: false
      style: deepObject
      explode: true
      schema:
        $ref: '#/components/schemas/DateFilterEnum'
      example: 2023-01-05T03:30:15Z

    DeactivationDateQueryParam:
      name: deactivation_date
      in: query
      description: |
        Resource deactivation date filter. Available filters are [eq, lt, lte, gt, gte]. Format according to ISO 8601
      required: false
      style: deepObject
      explode: true
      schema:
        $ref: '#/components/schemas/DateFilterEnum'
      example: 2023-01-05T03:30:15Z

    ExpirationDateQueryParam:
      name: expiration_date
      in: query
      description: |
        Resource expiration date filter. Available filters are [eq, lt, lte, gt, gte]. Format according to ISO 8601
      required: false
      style: deepObject
      explode: true
      schema:
        $ref: '#/components/schemas/DateFilterEnum'
      example: 2023-01-05T03:30:15Z

    CataloguePromotionIdQueryParam:
      name: catalogue_promotion_id
      in: query
      description: Catalogue promotion identifier
      required: false
      schema:
        type: string
      example: "124"

    MsisdnQueryParam:
      name: msisdn
      in: query
      description: |
        MSISDN (Mobile Station International Subscriber Directory Number) following E.164 format. Spanish country
        code is assumed if plus sign(+) is not included to indicate international format.
      required: false
      schema:
        type: string
      example: +34611223344

    DeviceIdQueryParam:
      name: device_id
      in: query
      description: Insured device ID
      required: false
      schema:
        type: string
        format: uuid
      example: 123e4567-e89b-12d3-a456-426614174000

    LegacyDeviceIdQueryParam:
      name: legacy_device_id
      in: query
      description: Legacy Id of the insured device in MySim/Apollo storage
      required: false
      schema:
        type: integer
      example: 123456

  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
