openapi: 3.0.3

info:
  title: Participant Default Types
  description: "For retrieving and setting default types on a Contact. For historical reasons a Contact is sometimes also referred to as a Participant, even though a Contact only technically becomes a Participant when associated with a Matter. For a detailed explanation please refer to the tutorial on the API Developer Portal. E&OE."
  version: "1.0"

externalDocs:
  description: Tutorial - Working with Participant Default Types
  url: https://docs.actionstep.com/tutorial-participant-default-types/

paths:
  '/participantdefaulttypes':
    get:
      description: Returns a list of participant default types for each Contact.
      tags:
        - Participant Default Types
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PagedParticipantDefaultTypes'

    post:
      description: Add an existing participant default type to an existing Contact.
      tags:
        - Participant Default Types
      requestBody:
        $ref: '#/components/requestBodies/AddParticipantDefaultType'
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ParticipantDefaultType'

  '/participantdefaulttypes/{id}': 
    delete:
      description: Removes a participant default type from a Contact.
      tags:
        - Participant Default Types
      parameters:
        - name: id
          in: path
          description: Unique identifier for a participant default type. The identifier is a composite value composed from the participant (contact) identifier and the participant type identifier, separated by "--".
          required: true
          schema:
            type: string
          example: 1024--31
      responses:
        '204':
          description: Success, No content.

components:
  schemas:
    PagedParticipantDefaultTypes:
      type: object
      properties:
        participantdefaulttypes:
          type: array
          items:
            $ref: '#/components/schemas/ParticipantDefaultType'
        meta:
          $ref: '#/components/schemas/PageMetaData'

    PageMetaData:
      type: object
      properties:
        paging:
          $ref: '#/components/schemas/PagingData'

    PagingData:
      type: object
      properties:
        participantdefaulttypes:
          $ref: '#/components/schemas/ParticipantDefaultTypesPageData'

    ParticipantDefaultTypesPageData:
      type: object
      properties:
        recordCount:
          description: The total number of participant default types returned by the underlying query.
          type: integer
          example: 23
        pageCount:
          description: The total number of pages generated by the underlying query.
          type: integer
          example: 47
        page:
          description: The page number for this page of participant default types.
          type: integer
          example: 2
        pageSize:
          description: Page size.
          type: integer
          example: 50
        prevPage:
          description: A URL to the previous page of participant default types.
          type: string
          example: https://ap-southeast-2.actionstep.com/api/rest/participantdefaulttypes?page=1
        nextPage:
          description: A URL to the next page of participant default types.
          type: string
          example: https://ap-southeast-2.actionstep.com/api/rest/participantdefaulttypes?page=3

    ParticipantDefaultType:
      type: object
      properties:
        id:
          description: Unique identifier for a participant default type. The identifier is a composite value composed from the participant identifier and the participant type identifier, separated by "--".
          example: 1024--31
          type: string
        links:
          $ref: '#/components/schemas/ParticipantDefaultTypeLinks'

    ParticipantDefaultTypeLinks:
      type: object
      properties:
        participantType:
          description: Unique identifier of the participant type.
          example: 31
          type: integer
        participant:
          description: Unique identifier of the participant.
          example: 1024
          type: integer

    CreateParticipantDefaultType:
      type: object
      properties:
        participantdefaulttypes:
          $ref: '#/components/schemas/CreateParticipantDefaultTypeLinks'

    CreateParticipantDefaultTypeLinks:
      type: object
      properties:
        links:
          $ref: '#/components/schemas/CreateParticipantDefaultTypeLinksLink'

    CreateParticipantDefaultTypeLinksLink:
      type: object
      properties:
        participantType:
          description: Unique identifier of the participant type.
          example: 31
          type: integer
        participant:
          description: Unique identifier of the participant.
          example: 1024
          type: integer

  requestBodies:
    AddParticipantDefaultType:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreateParticipantDefaultType'