openapi: 3.1.0
info:
  title: api-customer
  contact: {}
  license:
    name: MIT License
    url: https://opensource.org/licenses/MIT
  version: "4.0"
servers:
- url: http://localhost:59762
  description: Generated server url
tags:
- name: Details
  description: Details operations
- name: Customer
  description: Customer operations
- name: Relation
  description: Relations operations
paths:
  /{municipalityId}/details:
    post:
      tags:
      - Details
      summary: Get customer by party-ID or organization id for customer engagements
      operationId: getCustomerDetails
      parameters:
      - name: municipalityId
        in: path
        description: Municipality id
        required: true
        schema:
          type: string
        example: 2281
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CustomerDetailsRequest"
        required: true
      responses:
        "200":
          description: Successful Operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomerDetailsResponse"
            application/problem+json:
              schema:
                $ref: "#/components/schemas/CustomerDetailsResponse"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "500":
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "502":
          description: Bad Gateway
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
  /{municipalityId}/relations/{partyId}:
    get:
      tags:
      - Relation
      summary: Get customer by party-ID
      operationId: getRelationByPartyId
      parameters:
      - name: municipalityId
        in: path
        description: Municipality id
        required: true
        schema:
          type: string
        example: 2281
      - name: partyId
        in: path
        description: Party-ID
        required: true
        schema:
          type: string
        example: 81471222-5798-11e9-ae24-57fa13b361e1
      responses:
        "200":
          description: Successful Operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Customer"
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Customer"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "500":
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "502":
          description: Bad Gateway
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
  /{municipalityId}/customers/{partyId}:
    get:
      tags:
      - Customer
      summary: Get customer by party-ID
      operationId: getCustomerByPartyId
      parameters:
      - name: municipalityId
        in: path
        description: Municipality id
        required: true
        schema:
          type: string
        example: 2281
      - name: partyId
        in: path
        description: Party-ID
        required: true
        schema:
          type: string
        example: 81471222-5798-11e9-ae24-57fa13b361e1
      responses:
        "200":
          description: Successful Operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Customer"
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Customer"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "500":
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "502":
          description: Bad Gateway
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      deprecated: true
  /api-docs:
    get:
      tags:
      - API
      summary: OpenAPI
      operationId: getApiDocs
      responses:
        "200":
          description: OK
          content:
            application/yaml:
              schema:
                type: string
      x-auth-type: None
      x-throttling-tier: Unlimited
      x-wso2-mutual-ssl: Optional
components:
  schemas:
    Problem:
      type: object
      properties:
        title:
          type: string
        detail:
          type: string
        instance:
          type: string
          format: uri
        type:
          type: string
          format: uri
        status:
          type: integer
          format: int32
    ConstraintViolationProblem:
      type: object
      properties:
        type:
          type: string
          format: uri
        status:
          type: integer
          format: int32
        violations:
          type: array
          items:
            $ref: "#/components/schemas/Violation"
        title:
          type: string
        causeAsProblem:
          $ref: "#/components/schemas/ThrowableProblem"
        detail:
          type: string
        instance:
          type: string
          format: uri
    ThrowableProblem:
      type: object
      properties:
        type:
          type: string
          format: uri
        title:
          type: string
        status:
          type: integer
          format: int32
        detail:
          type: string
        instance:
          type: string
          format: uri
        causeAsProblem: {}
    Violation:
      type: object
      properties:
        field:
          type: string
        message:
          type: string
    CustomerDetailsRequest:
      type: object
      description: Customer details request
      properties:
        page:
          type: integer
          format: int32
          default: 1
          description: Page number
          examples:
          - 1
          minimum: 1
        limit:
          type: integer
          format: int32
          description: Result size per page. Maximum allowed value is dynamically
            configured
          examples:
          - 15
          minimum: 1
        sortBy:
          type: array
          items:
            type: string
            description: The properties to sort on
            examples:
            - propertyName
        sortDirection:
          $ref: "#/components/schemas/Direction"
          description: The sort order direction
          examples:
          - ASC
        partyId:
          type: array
          items:
            type: string
            description: List of Party-IDs
        customerEngagementOrgId:
          type: string
          description: Organization id for customer engagements
          minLength: 1
        fromDateTime:
          type: string
          format: date-time
          description: Earliest date and time for when to search for change from.
            Format is yyyy-MM-dd'T'HH:mm:ss.SSSXXX
          examples:
          - 2000-10-31T01:30:00.000-05:00
      required:
      - customerEngagementOrgId
    Direction:
      type: string
      enum:
      - ASC
      - DESC
    CustomerDetails:
      type: object
      description: Customer details model
      properties:
        customerEngagementOrgId:
          type: string
          description: Company with which the customer has an engagement (organization
            number)
          examples:
          - "5591962591"
          readOnly: true
        customerEngagementOrgName:
          type: string
          description: Name of the company the customer has an engagement with
          examples:
          - Sundsvall Elnät
          readOnly: true
        partyId:
          type: string
          description: PartyId (e.g. a personId or an organizationId)
          examples:
          - 81471222-5798-11e9-ae24-57fa13b361e1
          readOnly: true
        customerNumber:
          type: string
          description: Customer number
          examples:
          - "39195"
          readOnly: true
        customerName:
          type: string
          description: Customer name
          examples:
          - Sven Svensson
          readOnly: true
        street:
          type: string
          description: Street
          examples:
          - Storgatan 44
          readOnly: true
        postalCode:
          type: string
          description: Postal code
          examples:
          - "85230"
          readOnly: true
        city:
          type: string
          description: City
          examples:
          - Sundsvall
          readOnly: true
        careOf:
          type: string
          description: Care of address
          examples:
          - Agatha Malm
          readOnly: true
        phoneNumbers:
          type: array
          items:
            type: string
            description: List of phoneNumbers
            examples:
            - 076-1234567
            readOnly: true
        emails:
          type: array
          items:
            type: string
            description: List of emailAddresses
            examples:
            - test@test.se
            readOnly: true
        customerCategoryID:
          type: integer
          format: int32
          description: Customer category ID
          examples:
          - 1
          readOnly: true
        customerCategoryDescription:
          type: string
          description: Customer category description
          examples:
          - Privat
          readOnly: true
        customerChangedFlg:
          type: boolean
          description: Indicates if customer details have changed since the search
            date
          examples:
          - PRIVATE
          readOnly: true
        installedChangedFlg:
          type: boolean
          description: Indicates if placement and/or equipment details have changed
            since the search date
          examples:
          - "true"
          readOnly: true
        active:
          type: boolean
          description: "Indicates customer status, if not active then the moveInDate\
            \ holds information on when the customer will be activated"
          examples:
          - "true"
          readOnly: true
        moveInDate:
          type: string
          format: date
          description: The prospective customer's move-in date
          readOnly: true
    CustomerDetailsResponse:
      type: object
      description: Customer details response model
      properties:
        customerDetails:
          type: array
          items:
            $ref: "#/components/schemas/CustomerDetails"
            readOnly: true
        _meta:
          $ref: "#/components/schemas/PagingAndSortingMetaData"
          readOnly: true
    PagingAndSortingMetaData:
      type: object
      description: PagingAndSortingMetaData model
      properties:
        page:
          type: integer
          format: int32
          description: Current page
          examples:
          - 5
          readOnly: true
        limit:
          type: integer
          format: int32
          description: Displayed objects per page
          examples:
          - 20
          readOnly: true
        count:
          type: integer
          format: int32
          description: Displayed objects on current page
          examples:
          - 13
          readOnly: true
        totalRecords:
          type: integer
          format: int64
          description: Total amount of hits based on provided search parameters
          examples:
          - 98
          readOnly: true
        totalPages:
          type: integer
          format: int32
          description: Total amount of pages based on provided search parameters
          examples:
          - 23
          readOnly: true
        sortBy:
          type: array
          items:
            type: string
            description: The properties to sort by
            examples:
            - property
            readOnly: true
        sortDirection:
          $ref: "#/components/schemas/Direction"
          description: The sort order direction
          examples:
          - ASC
    Customer:
      type: object
      description: Customer model
      properties:
        customerType:
          $ref: "#/components/schemas/CustomerType"
          readOnly: true
        customerRelations:
          type: array
          items:
            $ref: "#/components/schemas/CustomerRelation"
    CustomerRelation:
      type: object
      description: Customer relation model
      properties:
        customerNumber:
          type: string
          description: Customer number
          examples:
          - "10007"
          readOnly: true
        organizationNumber:
          type: string
          description: Organization number
          examples:
          - "5565027223"
          readOnly: true
        organizationName:
          type: string
          description: Organization name
          examples:
          - Sundsvall Elnät
          readOnly: true
        active:
          type: boolean
          description: "Indicates customer status, if not active then the moveInDate\
            \ holds information on when the customer will be activated"
          examples:
          - "true"
          readOnly: true
        moveInDate:
          type: string
          format: date
          description: The prospective customer's move-in date
          readOnly: true
    CustomerType:
      type: string
      description: Customer type model
      enum:
      - PRIVATE
      - ENTERPRISE
  securitySchemes: {}
