openapi: 3.1.0
info:
  title: API Reference
  contact:
    name: Probation Integration Team
    url: https://moj.enterprise.slack.com/archives/C02QSERFGMB
    email: probation-integration@JusticeUK.onmicrosoft.com
  license:
    name: MIT
    url: https://github.com/ministryofjustice/hmpps-probation-integration-services/blob/main/LICENSE
  version: "1.0"
servers:
- url: /
security:
- hmpps-auth-token: []
paths:
  /case/{crn}:
    get:
      tags:
      - person-details-and-circumstances-controller
      operationId: getCase
      parameters:
      - name: crn
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PersonalDetailsAndCircumstances"
  /case/{crn}/home-office-interest:
    get:
      tags:
      - home-office-interest-controller
      operationId: getHomeOfficeInterest
      parameters:
      - name: crn
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HomeOfficeInterest"
  /case/{crn}/community-manager:
    get:
      tags:
      - community-manager-controller
      operationId: getCommunityManagerByCrn
      parameters:
      - name: crn
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CommunityOffenderManager"
components:
  schemas:
    CodeAndDescription:
      type: object
      properties:
        code:
          type: string
        description:
          type: string
      required:
      - code
      - description
    Disability:
      type: object
      properties:
        type:
          $ref: "#/components/schemas/CodeAndDescription"
        updatedAt:
          type: string
          format: date-time
      required:
      - type
      - updatedAt
    OffenderPersonalityDisorder:
      type: object
      properties:
        status:
          $ref: "#/components/schemas/CodeAndDescription"
      required:
      - status
    PersonCircumstance:
      type: object
      properties:
        type:
          $ref: "#/components/schemas/CodeAndDescription"
        subType:
          $ref: "#/components/schemas/CodeAndDescription"
        updatedAt:
          type: string
          format: date-time
      required:
      - subType
      - type
      - updatedAt
    PersonalDetailsAndCircumstances:
      type: object
      properties:
        preferredLanguage:
          oneOf:
          - $ref: "#/components/schemas/CodeAndDescription"
          - type: "null"
        personalCircumstances:
          type:
          - array
          - "null"
          items:
            $ref: "#/components/schemas/PersonCircumstance"
        disabilities:
          type:
          - array
          - "null"
          items:
            $ref: "#/components/schemas/Disability"
        offenderPersonalityDisorder:
          oneOf:
          - $ref: "#/components/schemas/OffenderPersonalityDisorder"
          - type: "null"
    HomeOfficeInterest:
      type: object
      properties:
        exists:
          type: boolean
        notes:
          type:
          - string
          - "null"
      required:
      - exists
    CommunityManager:
      type: object
      properties:
        jobRole:
          type:
          - string
          - "null"
        emailAddress:
          type:
          - string
          - "null"
        pdu:
          type: string
        officeName:
          type:
          - string
          - "null"
        name:
          $ref: "#/components/schemas/Name"
        teamPhoneNumber:
          type:
          - string
          - "null"
      required:
      - name
      - pdu
    CommunityOffenderManager:
      type: object
      properties:
        crn:
          type: string
        communityManager:
          $ref: "#/components/schemas/CommunityManager"
      required:
      - communityManager
      - crn
    Name:
      type: object
      properties:
        forename:
          type: string
        middleName:
          type:
          - string
          - "null"
        surname:
          type: string
      required:
      - forename
      - surname
  securitySchemes:
    hmpps-auth-token:
      type: http
      name: Authorization
      in: header
      scheme: bearer
      bearerFormat: JWT
