openapi: 3.0.0
info:
  title: Custom Parameters API
  version: 1.0.0
  x-product-id: DrillPlan-Custom-Parameters-API
  description: |
    ```plain {% title="Client ID" %}
    fwk-drillplan.slbservice.com
     ```
security:
  - bearer: []
    appkey: []
paths:
  /v1/parameter-definitions:
    get:
      tags:
        - ParameterDefinitions
      summary: Retrieves the latest version of the parameter definitions
      description: Retrieves the latest version of the parameter definitions
      parameters:
        - $ref: '#/components/parameters/dataPartitionHeader'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ParameterDefinitionSetDto'
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    post:
      tags:
        - ParameterDefinitions
      summary: Creates a new parameter definition.
      description: Creates a new parameter definition.
      parameters:
        - $ref: '#/components/parameters/dataPartitionHeader'
      requestBody:
        x-name: createParameterDefinitionRequestDto
        description: A new parameter definition to create.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateParameterDefinitionRequestDto'
        required: true
        x-position: 1
      responses:
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /v1/parameter-definitions/{id}:
    delete:
      tags:
        - ParameterDefinitions
      summary: Deletes a parameter definition.
      description: Deletes a parameter definition.
      parameters:
        - name: id
          in: path
          description: Id of the parameter definition to be deleted
          required: true
          schema:
            type: string
            nullable: true
          x-position: 1
        - $ref: '#/components/parameters/dataPartitionHeader'
      responses:
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    get:
      tags:
        - ParameterDefinitions
      summary: Retrieves a parameter definition by id.
      description: Retrieves a parameter definition by id.
      parameters:
        - name: id
          in: path
          description: Id of a parameter definition
          required: true
          schema:
            type: string
            nullable: true
          x-position: 1
        - $ref: '#/components/parameters/dataPartitionHeader'
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ParameterDefinitionDto'
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    put:
      tags:
        - ParameterDefinitions
      summary: Updates a parameter definition.
      description: Updates a parameter definition.
      parameters:
        - name: id
          in: path
          description: Id of a parameter definition
          required: true
          schema:
            type: string
            nullable: true
          x-position: 1
        - $ref: '#/components/parameters/dataPartitionHeader'
      requestBody:
        description: new content of a parameter definition
        x-name: updateParameterDefinitionRequestDto
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateParameterDefinitionRequestDto'
        required: true
        x-position: 2
      responses:
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
components:
  parameters:
    dataPartitionHeader:
      name: slb-partition-id
      in: header
      description: The data partition id.
      required: true
      schema:
        type: string
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: User Token from SLB Authenticator Service
    appkey:
      type: apiKey
      name: appkey
      in: header
  schemas:
    ProblemDetails:
      type: object
      additionalProperties:
        nullable: true
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
        extensions:
          type: object
          additionalProperties: {}
    ParameterDefinitionSetDto:
      type: object
      additionalProperties: false
      required:
        - version
        - definitions
      properties:
        version:
          type: string
          description: Gets or Sets _Version
          minLength: 1
        definitions:
          type: array
          description: Gets or Sets Definitions
          items:
            $ref: '#/components/schemas/ParameterDefinitionDto'
    ParameterDefinitionDto:
      type: object
      additionalProperties: false
      required:
        - id
        - name
        - type
        - level
        - last_modified
      properties:
        id:
          type: string
          description: The parameter ID.
          minLength: 1
        name:
          type: string
          description: The parameter name.
          minLength: 1
        type:
          description: Gets or Sets Type
          oneOf:
            - $ref: '#/components/schemas/ParameterTypeDto'
        level:
          description: Gets or Sets Level
          oneOf:
            - $ref: '#/components/schemas/ObjectTypeDto'
        last_modified:
          type: string
          description: The date and time when the definition was last modified.
          format: date-time
          minLength: 1
        description:
          type: string
          description: The parameter description.
        is_available_as_ddi:
          type: boolean
          description: Gets or Sets IsAvailableAsDDI
        unique_id:
          type: string
          description: Gets or Sets UniqueId
        tags:
          type: array
          description: Gets or Sets Tags
          items:
            type: string
        options:
          type: object
          description: Gets or Sets Options (also be called as List on UI)
          additionalProperties:
            type: string
    ParameterTypeDto:
      type: string
      description: The parameter type.
      x-enumNames:
        - Number
        - String
        - Boolean
        - Options
      enum:
        - Number
        - String
        - Boolean
        - Options
    ObjectTypeDto:
      type: string
      description: The DrillPlan object type.
      x-enumNames:
        - Well
        - Wellbore
        - Section
      enum:
        - Well
        - Wellbore
        - Section
    UpdateParameterDefinitionRequestDto:
      type: object
      additionalProperties: false
      required:
        - id
        - name
        - type
        - level
        - unique_id
      properties:
        id:
          type: string
          description: Gets or Sets Id
          minLength: 1
        name:
          type: string
          description: Gets or Sets Name
          maxLength: 128
          minLength: 1
        type:
          description: Gets or Sets Type
          oneOf:
            - $ref: '#/components/schemas/ParameterTypeDto'
        level:
          description: Gets or Sets Level
          oneOf:
            - $ref: '#/components/schemas/ObjectTypeDto'
        unique_id:
          type: string
          description: Gets or Sets UniqueId
        description:
          type: string
          description: Gets or Sets Description
          maxLength: 500
        is_available_as_ddi:
          type: boolean
          description: Gets or Sets IsAvailableAsDDI
        tags:
          type: array
          description: Gets or Sets Tags
          nullable: true
          items:
            type: string
        options:
          type: object
          description: Gets or Sets Options (also be called as List on UI)
          additionalProperties:
            type: string
    CreateParameterDefinitionRequestDto:
      type: object
      additionalProperties: false
      required:
        - name
        - type
        - level
      properties:
        name:
          type: string
          description: Gets or Sets Name
          maxLength: 128
          minLength: 1
        type:
          description: Gets or Sets Type
          oneOf:
            - $ref: '#/components/schemas/ParameterTypeDto'
        level:
          description: Gets or Sets Level
          oneOf:
            - $ref: '#/components/schemas/ObjectTypeDto'
        description:
          type: string
          description: Gets or Sets Description
          maxLength: 500
          nullable: true
        is_available_as_ddi:
          type: boolean
          description: Gets or Sets IsAvailableAsDDI
          nullable: true
        unique_id:
          type: string
          description: Gets or Sets UniqueId
          maxLength: 500
          nullable: true
        tags:
          type: array
          description: Gets or Sets Tags
          nullable: true
          items:
            type: string
        options:
          type: object
          description: Gets or Sets Options (also be called as List on UI)
          additionalProperties:
            type: string
servers:
  - url: https://eu-api.delfi.slb.com/drillplan/custom-parameters
    description: ProdEU
  - url: https://api.delfi.slb.com/drillplan/custom-parameters
    description: ProdUS
