openapi: 3.0.3

info:
  title: Participant Relationship Types
  description: "For managing the collection of Participant Relationship Types. E&OE."
  version: "1.0"

paths:
  '/participantrelationshiptypes':
    get:
      description: Returns a list of all Participant Relationship Types.
      tags:
        - Participant Relationship Types
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/participantrelationshiptypes'

    post:
      description: Create a new participant relationship type. 
      tags:
        - Participant Relationship Types
      requestBody:
        $ref: '#/components/requestBodies/CreateParticipantRelationshipType'
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ParticipantRelationshipType'

  '/participantrelationshiptypes/{id}': 
    get:
      description: Returns a single participant relationship type.
      tags:
        - Participant Relationship Types
      parameters:
        - name: id
          in: path
          description: Unique identifier for the participant relationship type. This is a composite key composed from the category and relationship properties, separated by '--'.
          required: true
          schema:
            type: string
          example: IndividualToIndividual--Acquaintance
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ParticipantRelationshipType'

    delete:
      description: Delete a single participant relationship type.
      tags:
        - Participant Relationship Types
      parameters:
        - name: id
          in: path
          description: Unique identifier for the participant relationship type. This is a composite key composed from the category and relationship properties, separated by '--'.
          required: true
          schema:
            type: string
          example: IndividualToIndividual--Acquaintance
      responses:
        '204':
          description: Success, No content.

components:
  schemas:
    participantrelationshiptypes:
      type: object
      properties:
        participantrelationshiptypes:
          type: array
          items:
            $ref: '#/components/schemas/ParticipantRelationshipType'
        meta:
          $ref: '#/components/schemas/PageMetaData'

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

    PagingData:
      type: object
      properties:
        participantrelationshiptypes:
          $ref: '#/components/schemas/ParticipantRelationshipTypePageData'

    ParticipantRelationshipTypePageData:
      type: object
      properties:
        recordCount:
          description: The total number of Participant Relationship Types returned by the underlying query.
          type: integer
          example: 4
        pageCount:
          description: The total number of pages generated by the underlying query.
          type: integer
          example: 8
        page:
          description: The page number for this page of Participant Relationship Types.
          type: integer
          example: 2
        pageSize:
          description: Page size.
          type: integer
          example: 50
        prevPage:
          description: A URL to the previous page of Participant Relationship Types.
          type: string
          example: https://ap-southeast-2.actionstep.com/api/rest/participantrelationshiptypes?page=1
        nextPage:
          description: A URL to the next page of Participant Relationship Types.
          type: string
          example: https://ap-southeast-2.actionstep.com/api/rest/participantrelationshiptypes?page=3

    ParticipantRelationshipType:
      type: object
      properties:
        category:
          description: The category for the relationship type.
          enum:
          - IndividualToIndividual
          - IndividualToCompany
          - CompanyToIndividual
          - CompanyToCompany
          type: string
          format: string
          example: IndividualToIndividual
        relationshipType:
          description: The name for the relationship type.
          type: string
          format: string
          example: Acquaintance

    CreateParticipantRelationshipType:
      type: object
      required: 
        - category
        - relationship
      properties:
        category:
          description: The category for the relationship type.
          enum:
          - IndividualToIndividual
          - IndividualToCompany
          - CompanyToIndividual
          - CompanyToCompany
          type: string
          format: string
          example: IndividualToIndividual
        relationshipType:
          description: The name for the relationship type. A relationship type must be unique within a category.
          type: string
          format: string
          example: Acquaintance
          
  requestBodies:
    CreateParticipantRelationshipType:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreateParticipantRelationshipType'