openapi: 3.0.0
info:
  title: Delete Case API
  version: 1.0.0
  contact:
    name: Scalepoint
    url: 'https://dev.scalepoint.com'
    email: dev@scalepoint.com
servers:
  - url: 'https://entry.scalepoint.com/ecx/{tenant}/api/integration'
    description: Production server (uses live data)
    variables:
      tenant:
        description: IC tenant name
  - url: 'https://sandbox.scalepoint.com/ecx/{tenant}/api/integration'
    description: Sandbox server (uses test data)
    variables:
      tenant:
        description: IC tenant name
paths:
  '/{version}/case':
    delete:
      summary: Delete case
      operationId: caseDelete
      parameters:
        - name: version
          in: path
          description: API version
          required: true
          schema:
            type: string
            enum:
              - v1
            default: v1
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeleteCaseRequest'
            examples:
              CaseNumber:
                value:
                  caseIdentifierType: CaseNumberRequest
                  execute: true
                  caseNumber: CN10000
              CaseToken:
                value:
                  caseIdentifierType: CaseTokenRequest
                  execute: true
                  caseToken: b.00000000-0000-0000-0000-000000000000
              DryRun:
                value:
                  caseIdentifierType: CaseNumberRequest
                  execute: false
                  caseNumber: CN10000
              Re-run:
                value:
                  requestId: d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6
                  caseIdentifierType: CaseNumberRequest
                  execute: true
                  caseNumber: CN10000
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteCaseResponse'
              examples:
                Example:
                  value:
                    requestId: d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6
                    found: true
                    deleted: true
                    messages:
                      - An additional message about the context of the deletion
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                BadRequest:
                  value:
                    requestId: 6f72b00a-7ea1-11ec-90d6-0242ac120003
                    deleted: false
                    errors:
                      - The provided requestId is already in use for another claim number/token
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                PendingPayment:
                  value:
                    requestId: 6f72b00a-7ea1-11ec-90d6-0242ac120003
                    found: true
                    deleted: false
                    errors:
                      - Claim has recent pending payments
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                CaseNotFound:
                  value:
                    requestId: d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6
                    found: false
                    deleted: false
                    errors:
                      - Case number CN10000 not found
        '429':
          description: Too Many Requests
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                UnexpectedError:
                  value:
                    requestId: 6f72b00a-7ea1-11ec-90d6-0242ac120003
                    found: true
                    deleted: false
                    errors:
                      - Unexpected error
      security:
        - bearerAuth: []
security:
  - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    DeleteCaseRequest:
      description: ''
      type: object
      x-examples:
        CaseNumber:
          requestId: 00000000-0000-0000-0000-000000000000
          caseIdentifierType: CaseNumberRequest
          execute: true
          caseNumber: CN10000
      properties:
        requestId:
          type: string
          minLength: 1
          format: uuid
        caseIdentifierType:
          type: string
          minLength: 1
          enum:
            - CaseNumberRequest
            - CaseTokenRequest
        execute:
          type: boolean
          default: true
        caseNumber:
          type: string
          minLength: 1
          description: Excludes with the caseToken field. Required when CaseNumberRequest is set in caseIdentifierType
        caseToken:
          type: string
          minLength: 1
          description: Excludes with the caseNumber field. Required when CaseTokenRequest is set in caseIdentifierType
      required:
        - caseIdentifierType
        - caseNumber
        - caseToken
    DeleteCaseResponse:
      description: ''
      type: object
      x-examples:
        ResponseWithMessage:
          requestId: 00000000-0000-0000-0000-000000000000
          found: false
          deleted: false
          messages:
            - An additional message about the context of the deletion
      title: DeleteCaseResponse
      properties:
        requestId:
          type: string
          minLength: 1
          format: uuid
        found:
          type: boolean
        deleted:
          type: boolean
        messages:
          type: array
          items:
            type:
              - string
      required:
        - requestId
        - found
        - deleted
        - messages
    ErrorResponse:
      description: ''
      type: object
      x-examples:
        CaseNotFound:
          requestId: 00000000-0000-0000-0000-000000000000
          found: false
          deleted: false
          errors:
            - Case number CN10000 not found
      examples:
        - requestId: 6f72b00a-7ea1-11ec-90d6-0242ac120003
          found: false
          deleted: false
          errors:
            - Case number CN10000 not found
        - requestId: string
          deleted: false
          errors:
            - Case deletion in progress.
      properties:
        requestId:
          type: string
          minLength: 1
          format: uuid
        found:
          type: boolean
        deleted:
          type: boolean
        errors:
          type: array
          items:
            type:
              - string
      required:
        - requestId
        - deleted
        - errors
