openapi: 3.0.1
info:
  title: id-rights-rest API
  version: "1.0.0"
  description: |
    ID-Rights Rest API provides you with official signature and procuration rights for all companies based on updated information 
    from public registers. We provide the necessary information in a structured way for a fully automated business processes.

    Please refer to the IN Groupe Developer site for details on how the E-Signing service works, and what the API can be used for.

    A merchant identifier (MID) and a secret code are required to integrate with Id-Rights API. 
    
    The identifier and the code can be received by using the [Contact us form](https://ingroupe.com/in-trust-services-support-contact-page/) to IN Groupe support.
    To receive a dedicated setup, you need to be an Id-Rights customer. To become a customer, [ Contact our sales department](https://ingroupe.com/product/id-rights/)

  termsOfService: http://swagger.io/terms/
  contact:
    url: https://doc.ingroupe.com/developer/id-rights
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html

paths:

  ###############################################################
  #
  # call messages
  #
  /{mid}/spinfo/{countryCode}:
    get:
      security:
        - idRightsAuth: [ get ]
      tags:
        - GetSPInfoByOrg
      summary: Get Signing and Procuration Info By Organization Number
      description:
        Get Signing and Procuration Info By Organization Number

      operationId: get-spinfobyorg

      parameters:
        - name: mid
          in: path
          description: A merchant ID is an identifier issued to each registered client.
                       Each call using this API will require the merchant ID to be provided.
          required: true
          example: '1001'
          schema:
            type: integer

        - name: countryCode
          in: path
          description: Country Code with two capital letters. e.g. NO for Norway, DK for Denmark, SE for Sweden and FI for Finnland
          required: true
          schema:
            $ref: '#/components/schemas/IdRightsTypeCountryCodeDef'

        - name: orgNum
          in: query
          description: Official organisation number.
          required: true
          style: form
          explode: true
          schema:
            $ref: '#/components/schemas/IdRightsTypeOrganisationNumberDef'

        - name: showheaderText
          in: query
          description: In case of Inconclusive answer, the text rule will be added to the response.
                       Only applicable for Swedish organisations.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Request processed succesfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSPInfoByOrgResponseResult'
        '400':
          description: Request failed (responseType will always be FAIL)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdRightsFailResponse'

  /{mid}/verifysp/{countryCode}:
    get:
      security:
        - idRightsAuth: [ get ]
      tags:
        - VerifySignatureAndProcuration
      summary: Verify Signing and Procuration Info for provided PersonIds for Organization Number
      description: >
        Verify Signing and Procuration Info for provided PersonIds for Organization Number
      operationId: verifysp

      parameters:
        - name: mid
          in: path
          description: See /{mid} from GetSPInfoByOrg.
          required: true
          example: '1001'
          schema:
            type: integer

        - name: countryCode
          in: path
          description: See /{countryCode} from GetSPInfoByOrg.
          required: true
          schema:
            $ref: '#/components/schemas/IdRightsTypeCountryCodeDef'

        - name: orgNum
          in: query
          description: See /{orgnum} from GetSPInfoByOrg.
          required: true
          schema:
            $ref: '#/components/schemas/IdRightsTypeOrganisationNumberDef'

        - name: personIds
          in: query
          description: Unique identifiers for persons.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Request processed succesfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VerifySignatureAndProcurationResponseResult'
        '400':
          description: Request failed (responseType will always be FAIL)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdRightsFailResponse'

  /{mid}/spcombinationbyorg/{countryCode}:
    get:
      security:
        - idRightsAuth: [ get ]
      tags:
        - GetSPCombinationByOrg
      summary: Get Signing and Procuration Info By Combination of Organization Number
      description: >
        Get Signing and Procuration Info By Combination of Organization Number
      operationId: get-spcombinationbyorg

      parameters:
        - name: mid
          in: path
          description: See /{mid} from GetSPCombinationByOrg.
          required: true
          example: '1001'
          schema:
            type: integer

        - name: countryCode
          in: path
          description: See /{countryCode} from GetSPCombinationByOrg.
          required: true
          schema:
            $ref: '#/components/schemas/IdRightsTypeCountryCodeDef'

        - name: orgNum
          in: query
          description: See /{orgnum} from GetSPCombinationByOrg.
          required: true
          schema:
            $ref: '#/components/schemas/IdRightsTypeOrganisationNumberDef'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSPCombinationByOrgResult'
        '400':
          description: Request failed (responseType will always be FAIL)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdRightsFailResponse'

  /{mid}/getbusinessinterests/{countryCode}:
    post:
      security:
        - idRightsAuth: [ post ]
      tags:
        - GetBusinessInterests
      summary: Get business interests providing social security number
      description: >
        Get Business interests Info for provided social security number
      operationId: post-getbusinessinterests

      parameters:
        - name: mid
          in: path
          description: See /{mid} from GetBusinessInterests.
          required: true
          example: '1001'
          schema:
            type: integer

        - name: countryCode
          in: path
          description: See /{countryCode} from GetBusinessInterests.
          required: true
          schema:
            $ref: '#/components/schemas/IdRightsTypeCountryCodeDef'

      requestBody:
        description: Request body has social security number as input to be passed
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BusinessInterestsReqDef'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetBusinessInterestsResult'
        '400':
          description: Request failed (responseType will always be FAIL)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdRightsFailResponse'

  /{mid}/beneficialowners/{countryCode}:
    get:
      security:
        - idRightsAuth: [ get ]
      tags:
        - GetBeneficialOwners
      summary: Get beneficial owners Info by Organization Number
      description: >
        GetBeneficialOwners identifies all beneficial owners based on the given organization number.
      operationId: get-getbeneficialowners

      parameters:
        - name: mid
          in: path
          description: See /{mid} from GetBeneficialOwners.
          required: true
          example: '1001'
          schema:
            type: integer

        - name: countryCode
          in: path
          description: See /{countryCode} from GetBeneficialOwners.
          required: true
          schema:
            $ref: '#/components/schemas/IdRightsTypeCountryCodeDef'

        - name: orgNum
          in: query
          description: See /{orgnum} from GetBeneficialOwners.
          required: true
          schema:
            $ref: '#/components/schemas/IdRightsTypeOrganisationNumberDef'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetBeneficialOwnersResult'
        '400':
          description: Request failed (responseType will always be FAIL)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdRightsFailResponse'

  /{mid}/spinfobypersonandorg/{countryCode}:
    post:
      security:
        - idRightsAuth: [ post ]
      tags:
        - GetSPInfoByPersonAndOrg
      summary: Get Signing and Procuration info by organization number and social security number
      description: >
        Get Signing and Procuration info by organization number and social security number
      operationId: post-getspinfobypersonandorg

      parameters:
        - name: mid
          in: path
          description: See /{mid} from GetSPInfoByPersonAndOrg.
          required: true
          example: '1001'
          schema:
            type: integer

        - name: countryCode
          in: path
          description: See /{countryCode} from GetSPInfoByPersonAndOrg.
          required: true
          schema:
            $ref: '#/components/schemas/IdRightsTypeCountryCodeDef'

      requestBody:
        description: Requires organization number and social security number to get Signing and Procuration info.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SPInfoByPersonAndOrgDef'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSPInfoByPersonAndOrgResult'
        '400':
          description: Request failed (responseType will always be FAIL)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdRightsFailResponse'

  /{mid}/orginfo/{countryCode}:
    post:
      security:
        - idRightsAuth: [ post ]
      tags:
        - GetOrgInfo
      summary: Get organization information by organization name and address.
      description: >
        Get organization information by organization name and address.
      operationId: post-orginfo

      parameters:
        - name: mid
          in: path
          description: See /{mid} from GetOrgInfo.
          required: true
          example: '1001'
          schema:
            type: integer

        - name: countryCode
          in: path
          description: See /{countryCode} from GetOrgInfo.
          required: true
          schema:
            $ref: '#/components/schemas/IdRightsTypeCountryCodeDef'

      requestBody:
        description: Organization name and address to be provided.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrgInfoDef'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetOrgInfoResult'
        '400':
          description: Request failed (responseType will always be FAIL)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdRightsFailResponse'

  /{mid}/originalsptext/{countryCode}:
    get:
      security:
        - idRightsAuth: [ get ]
      tags:
        - GetOriginalSPText
      summary: Get Original SP Text By Organization Number
      description: >
        Returns the original raw data from Brønnøysund (BRREG) containing information about signature and procuration 
        rights for the requested organization.
      operationId: get-originalsptext

      parameters:
        - name: mid
          in: path
          description: See /{mid} from GetOriginalSPText.
          required: true
          example: '1001'
          schema:
            type: integer

        - name: countryCode
          in: path
          description: See /{countryCode} from GetOriginalSPText.
          required: true
          schema:
            $ref: '#/components/schemas/IdRightsTypeCountryCodeDef'

        - name: orgNum
          in: query
          description: See /{orgnum} from GetOriginalSPText.
          required: true
          schema:
            $ref: '#/components/schemas/IdRightsTypeOrganisationNumberDef'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetOriginalSPTextResult'
        '400':
          description: Request failed (responseType will always be FAIL)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdRightsFailResponse'

  /{mid}/shadowregrecord/{countryCode}:
    post:
      security:
        - idRightsAuth: [ post ]
      tags:
        - ShadowRegRecord
      summary: Adding shadow register record is useful for compliance management.
      description: >
        Managed by the customer to blacklist (deny) or whitelist (allow) privileges to a selected company and/or person.
      operationId: post-shadowregrecord

      parameters:
        - name: mid
          in: path
          description: See /{mid} from AddShadowRegRecord.
          required: true
          example: '1001'
          schema:
            type: integer

        - name: countryCode
          in: path
          description: See /{countryCode} from AddShadowRegRecord.
          required: true
          schema:
            $ref: '#/components/schemas/IdRightsTypeCountryCodeDef'

      requestBody:
        description: Shadow register record details to add to the application.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ShadowRegRecordTypeDef'
        required: true

      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddShadowRegRecordResult'
        '400':
          description: Request failed (responseType will always be FAIL)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdRightsFailResponse'

  /{mid}/remove-shadowregrecord/{countryCode}:
    post:
      security:
        - idRightsAuth: [ delete ]
      tags:
        - ShadowRegRecord
      summary: Remove shadow register record
      description: >
        Remove any given shadow register data
      operationId: delete-shadowregrecord

      parameters:
        - name: mid
          in: path
          description: See /{mid} from RemoveShadowRegRecord.
          required: true
          example: '1001'
          schema:
            type: integer

        - name: countryCode
          in: path
          description: See /{countryCode} from RemoveShadowRegRecord.
          required: true
          schema:
            $ref: '#/components/schemas/IdRightsTypeCountryCodeDef'

      requestBody:
        description: To remove shadow register record - only recordType and recordValue fields are required to process.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ShadowRegRecordTypeDef'
        required: true

      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RemoveShadowRegRecordResult'
        '400':
          description: Request failed (responseType will always be FAIL)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdRightsFailResponse'

  /{mid}/get-shadowregrecord/{countryCode}:
    post:
      security:
        - idRightsAuth: [ get ]
      tags:
        - ShadowRegRecord
      summary: Get shadow register record by record identifier
      description: >
        Get shadow registered records for the provided list of record identifier which has only recordType, recordValue & recordName fields to process.
      operationId: get-shadowregrecord

      parameters:
        - name: mid
          in: path
          description: See /{mid} from GetShadowRegRecord.
          required: true
          example: '1001'
          schema:
            type: integer

        - name: countryCode
          in: path
          description: See /{countryCode} from GetShadowRegRecord.
          required: true
          schema:
            $ref: '#/components/schemas/IdRightsTypeCountryCodeDef'

      requestBody:
        description: To get shadow register record - can send list of record identifier with only recordType, recordValue & recordName fields to process.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetShadowRegRecordsDef'
        required: true

      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetShadowRegRecordResult'
        '400':
          description: Request failed (responseType will always be FAIL)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdRightsFailResponse'

  /{mid}/shadowregrecords/{countryCode}:
    get:
      security:
        - idRightsAuth: [ get ]
      tags:
        - ShadowRegRecord
      summary: Get all shadow register records.
      description: >
        Get all shadow registered records.
      operationId: get-shadowregrecords

      parameters:
        - name: mid
          in: path
          description: See /{mid} from GetShadowRegRecords.
          required: true
          example: '1001'
          schema:
            type: integer

        - name: countryCode
          in: path
          description: See /{countryCode} from GetShadowRegRecords.
          required: true
          schema:
            $ref: '#/components/schemas/IdRightsTypeCountryCodeDef'

      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetShadowRegRecordResult'
        '400':
          description: Request failed (responseType will always be FAIL)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdRightsFailResponse'

###############################################################
#
# Component schemas
#
components:
  schemas:
    GetSPInfoByOrgResponseResult:
      type: object
      properties:
        trustB2bHeader:
          $ref: '#/components/schemas/TrustB2BHeaderDef'
        getSPInfoByOrg:
          $ref: '#/components/schemas/GetSPInfoByOrgResponseTypeDef'

    VerifySignatureAndProcurationResponseResult:
      type: object
      properties:
        trustB2bHeader:
          $ref: '#/components/schemas/TrustB2BHeaderDef'
        verifySP:
          $ref: '#/components/schemas/VerifySignatureAndProcurationResponseTypeDef'

    GetSPCombinationByOrgResult:
      type: object
      properties:
        trustB2bHeader:
          $ref: '#/components/schemas/TrustB2BHeaderDef'
        getSPCombinationByOrg:
          $ref: '#/components/schemas/GetSPCombinationByOrgResponseTypeDef'

    GetBusinessInterestsResult:
      type: object
      properties:
        trustB2bHeader:
          $ref: '#/components/schemas/TrustB2BHeaderDef'
        getBusinessInterestsResponse:
          $ref: '#/components/schemas/GetBusinessInterestsResponseTypeDef'

    GetBeneficialOwnersResult:
      type: object
      properties:
        trustB2bHeader:
          $ref: '#/components/schemas/TrustB2BHeaderDef'
        getBeneficialOwnersResponse:
          $ref: '#/components/schemas/GetBeneficialOwnersResponseTypeDef'

    GetSPInfoByPersonAndOrgResult:
      type: object
      properties:
        trustB2bHeader:
          $ref: '#/components/schemas/TrustB2BHeaderDef'
        getSPInfoByPersonAndOrg:
          $ref: '#/components/schemas/GetSPInfoByPersonAndOrgResponseTypeDef'

    GetOrgInfoResult:
      type: object
      properties:
        trustB2bHeader:
          $ref: '#/components/schemas/TrustB2BHeaderDef'
        getOrgInfo:
          $ref: '#/components/schemas/GetOrgInfoResponseTypeDef'

    GetOriginalSPTextResult:
      type: object
      properties:
        trustB2bHeader:
          $ref: '#/components/schemas/TrustB2BHeaderDef'
        getOriginalSPText:
          $ref: '#/components/schemas/GetOriginalSPTextResponseTypeDef'

    AddShadowRegRecordResult:
      type: object
      properties:
        trustB2bHeader:
          $ref: '#/components/schemas/TrustB2BHeaderDef'
        addShadowRegRecordResponse:
          $ref: '#/components/schemas/ShadowRegRecordResponseTypeDef'

    RemoveShadowRegRecordResult:
      type: object
      properties:
        trustB2bHeader:
          $ref: '#/components/schemas/TrustB2BHeaderDef'
        removeShadowRegRecordResponse:
          $ref: '#/components/schemas/ShadowRegRecordResponseTypeDef'

    GetShadowRegRecordResult:
      type: object
      properties:
        trustB2bHeader:
          $ref: '#/components/schemas/TrustB2BHeaderDef'
        getShadowRegRecordResponse:
          $ref: '#/components/schemas/GetShadowRegRecordResponseTypeDef'

    TrustB2BHeaderDef:
      type: object
      properties:
        merchantId:
          type: string
        time:
          type: string
          format: date-time
        messageId:
          $ref: '#/components/schemas/IdRightsTypeObjectRefDef'
        transactionId:
          $ref: '#/components/schemas/IdRightsTypeObjectRefDef'
        countryCode:
          $ref: '#/components/schemas/IdRightsTypeCountryCodeDef'
        additionalInfo:
          $ref: '#/components/schemas/IdRightsTypeAdditionalInfoDef'

    GetSPInfoByOrgResponseTypeDef:
      type: object
      properties:
        companyRoles:
          type: array
          items:
            $ref: '#/components/schemas/CompanyRoleTypeDef'
        interpretedSPInfoList:
          type: array
          items:
            $ref: '#/components/schemas/InterpretedSPInfoTypeDef'
        shadowRegEntry:
          $ref: '#/components/schemas/ShadowRegRecordTypeDef'

    GetSPCombinationByOrgResponseTypeDef:
      type: object
      properties:
        companyRoles:
          type: array
          items:
            $ref: '#/components/schemas/CompanyRoleTypeDef'
        interpretedSPInfoList:
          type: array
          items:
            $ref: '#/components/schemas/InterpretedSPInfoTypeDef'
        signatureCombinationsResult:
          type: string
        signatureCombinations:
          type: array
          items:
            $ref: '#/components/schemas/SPCombinationsDef'
        procurationCombinationsResult:
          type: string
        procurationCombinations:
          type: array
          items:
            $ref: '#/components/schemas/SPCombinationsDef'

    GetBusinessInterestsResponseTypeDef:
      type: object
      properties:
        personId:
          $ref: '#/components/schemas/PersonIdSSNTypeDef'
        businessInterestList:
          $ref: '#/components/schemas/BusinessInterestListDef'


    GetSPInfoByPersonAndOrgResponseTypeDef:
      type: object
      properties:
        person:
          $ref: '#/components/schemas/PersonTypeDef'
        companyRoles:
          type: array
          items:
            $ref: '#/components/schemas/CompanyRoleTypeDef'
        interpretedSPInfoList:
          type: array
          items:
            $ref: '#/components/schemas/InterpretedSPInfoTypeDef'
        shadowRegEntry:
          $ref: '#/components/schemas/ShadowRegRecordTypeDef'

    GetOriginalSPTextResponseTypeDef:
      type: object
      properties:
        interpretedSPTexts:
          type: array
          items:
            $ref: '#/components/schemas/InterpretedSPInfoTypeDef'
        shadowRegRecord:
          $ref: '#/components/schemas/ShadowRegRecordTypeDef'


    ShadowRegRecordResponseTypeDef:
      type: object
      properties:
        statusCode:
          type: string
        description:
          type: string

    GetShadowRegRecordResponseTypeDef:
      type: object
      properties:
        recordCount:
          type: integer
        recordList:
          type: array
          items:
            $ref: '#/components/schemas/ShadowRegRecordTypeDef'

    VerifySignatureAndProcurationResponseTypeDef:
      type: object
      properties:
        dataSource:
          $ref: '#/components/schemas/DataSourceTypeEnum'
        signatureType:
          $ref: '#/components/schemas/SignatureTypeEnum'
        signatureConclusion:
          $ref: '#/components/schemas/SignatureConclusionTypeEnum'
        shadowRegEntry:
          $ref: '#/components/schemas/ShadowRegRecordTypeDef'

    GetOrgInfoResponseTypeDef:
      type: object
      properties:
        companies:
          type: array
          items:
            $ref: '#/components/schemas/CompanyDef'

    CompanyDef:
      type: object
      properties:
        organizationNumber:
          $ref: '#/components/schemas/IdRightsTypeOrganisationNumberDef'
        companyName:
          $ref: '#/components/schemas/CompanyNameDef'
        companyStatus:
          $ref: '#/components/schemas/CompanyStatusDef'
        companyType:
          $ref: '#/components/schemas/CompanyTypeDef'
        companyAddress:
          $ref: '#/components/schemas/PersonAddressTypeDef'

    CompanyNameDef:
      type: object
      properties:
        officialName:
          type: string
        editedName:
          type: string
        legalName:
          type: string

    CompanyStatusDef:
      type: object
      properties:
        businessStatusCode:
          type: string
        description:
          type: string

    CompanyTypeDef:
      type: object
      properties:
        businessTypeCode:
          type: string
        description:
          type: string

    SPCombinationsDef:
      type: object
      properties:
        roles:
          type: array
          items:
            $ref: '#/components/schemas/RolesDef'

    RolesDef:
      type: object
      properties:
        role:
          type: array
          items:
            $ref: '#/components/schemas/CompanyRoleTypeDef'

    BusinessInterestListDef:
      type: object
      properties:
        businessInterest:
          type: array
          items:
            $ref: '#/components/schemas/BusinessInterestDef'

    BusinessInterestDef:
      type: object
      properties:
        registered:
          type: string
          format: date-time
        company:
          $ref: '#/components/schemas/CompanyDef'
        position:
          $ref: '#/components/schemas/BusinessPositionTypeDef'

    CompanyRoleTypeDef:
      type: object
      properties:
        person:
          $ref: '#/components/schemas/PersonTypeDef'
        businessPosition:
          $ref: '#/components/schemas/BusinessPositionTypeDef'
        legalGuardingText:
          type: string
        resigned:
          type: string

    BusinessPositionTypeDef:
      type: object
      properties:
        businessPositionCode:
          type: string
        description:
          type: string

    PersonTypeDef:
      type: object
      properties:
        personId:
          $ref: '#/components/schemas/PersonIdSSNTypeDef'
        personStatus:
          $ref: '#/components/schemas/PersonStatusTypeDef'
        sex:
          $ref: '#/components/schemas/PersonSexTypeEnum'
        birthday:
          type: string
        age:
          type: integer
        name:
          $ref: '#/components/schemas/PersonNameTypeDef'
        updated:
          type: string
          format: date-time
        address:
          $ref: '#/components/schemas/PersonAddressTypeDef'
        roletext:
          type: string

    PersonIdSSNTypeDef:
      type: object
      properties:
        socialSecurityNumber:
          $ref: '#/components/schemas/IdRightsTypeSocialSecurityNumberDef'

    PersonStatusTypeDef:
      type: object
      properties:
        personStatusCode:
          type: string
        description:
          type: string

    PersonNameTypeDef:
      type: object
      properties:
        shortendName:
          type: string
        firstName:
          type: string
        middleName:
          type: string
        lastName:
          type: string

    PersonAddressTypeDef:
      type: object
      properties:
        streetAddress:
          type: string
        postalCode:
          type: string
        postalName:
          type: string


    InterpretedSPInfoTypeDef:
      type: object
      properties:
        dataSource:
          $ref: '#/components/schemas/DataSourceTypeEnum'
        signatureType:
          $ref: '#/components/schemas/SignatureTypeEnum'
        signatureRelationType:
          $ref: '#/components/schemas/SignatureRelationTypeEnum'
        signatureConclusionType:
          $ref: '#/components/schemas/SignatureConclusionTypeEnum'
        headerText:
          type: string
        sigAndProcRelations:
          type: array
          items:
            $ref: '#/components/schemas/SigAndProcRelationTypeDef'

    SigAndProcRelationTypeDef:
      type: object
      description: it should contain either Role relation or person relation
      properties:
        roleSPRelation:
          $ref: '#/components/schemas/RoleSPRelationTypeDef'
        personSPRelation:
          $ref: '#/components/schemas/PersonSPRelationTypeDef'

    RoleSPRelationTypeDef:
      type: object
      properties:
        count:
          type: integer
        businessPosition:
          $ref: '#/components/schemas/BusinessPositionTypeDef'

    PersonSPRelationTypeDef:
      type: object
      properties:
        person:
          $ref: '#/components/schemas/PersonTypeDef'

    ShadowRegRecordTypeDef:
      type: object
      properties:
        recordType:
          $ref: '#/components/schemas/ShadowRegRecordTypeEnum'
        recordValue:
          type: string
          pattern: '^[0-9]{1,20}$'
        actionType:
          $ref: '#/components/schemas/ActionTypeEnum'
        description:
          type: string
        insertedDate:
          type: string
          format: date-time
        recordName:
          type: string

    GetBeneficialOwnersResponseTypeDef:
      type: object
      properties:
        beneficialOwners:
          type: array
          items:
            $ref: '#/components/schemas/BeneficialOwnerDef'

    BeneficialOwnerDef:
      type: object
      properties:
        status:
          type: string
        socialSecurityNumber:
          $ref: '#/components/schemas/IdRightsTypeSocialSecurityNumberDef'
        name:
          type: string
        lcode:
          type: string
        share:
          type: string
        code:
          type: string

    BusinessInterestsReqDef:
      type: object
      properties:
        personId:
          $ref: '#/components/schemas/PersonIdSSNTypeDef'

    SPInfoByPersonAndOrgDef:
      type: object
      properties:
        organizationNumber:
          $ref: '#/components/schemas/IdRightsTypeOrganisationNumberDef'
        personId:
          $ref: '#/components/schemas/PersonIdSSNTypeDef'

    OrgInfoDef:
      type: object
      properties:
        organizationName:
          $ref: '#/components/schemas/IdRightsTypeOrganisationNameDef'
        organizationAddress:
          $ref: '#/components/schemas/IdRightsTypeOrganisationAddressDef'

    GetShadowRegRecordsDef:
      type: object
      properties:
        recordIdentifier:
          type: array
          items:
            $ref: '#/components/schemas/ShadowRegRecordTypeDef'

    IdRightsFailResponse:
      type: object
      properties:
        responseType:
          $ref: '#/components/schemas/IdRightsResponseTypesEnum'
        responseId:
          $ref: '#/components/schemas/IdRightsTypeTIDDef'
        message:
          type: string

    IdRightsTypeTIDDef:
      type: string
      pattern: '^[a-zA-Z0-9]{36,64}$'

    IdRightsTypeOrganisationNumberDef:
      type: string
      pattern: '^.{0,20}$'

    IdRightsTypeAdditionalInfoDef:
      type: string
      pattern: '^.{0,50}$'

    IdRightsTypeCountryCodeDef:
      type: string
      pattern: '^.{2}$'
      example: 'NO'

    IdRightsTypeSocialSecurityNumberDef:
      type: string
      pattern: '[0-9]{6}|[0-9]{10,12}|([0-9]{6}[-+ABCDEFUVWXY]{1}[0-9]{3}[0-9ABCDEFHJKLMNPRSTUVWXY]{1})'

    IdRightsTypeUniqueIdDef:
      type: string
      pattern: '(-?[0-9])+'

    IdRightsTypeObjectRefDef:
      type: string
      pattern: '^[A-Z0-9]{8,80}$'
      example: 'C18087F624E18C5305FF58701249C2C880F60C8C'

    IdRightsTypeOrganisationNameDef:
      type: string
      pattern: '^.{0,200}$'

    IdRightsTypeOrganisationAddressDef:
      type: string
      pattern: '^.{0,200}$'

      ###############################################################
      #
      # Enumerations
      #

    PersonSexTypeEnum:
      type: string
      enum:
        - M
        - F

    ShadowRegRecordTypeEnum:
      type: string
      enum:
        - COMPANY
        - PERSON

    ActionTypeEnum:
      type: string
      enum:
        - APPROVE
        - REJECT

    DataSourceTypeEnum:
      type: string
      enum:
        - BRREG
        - EXPERIAN
        - UC
        - BV
        - VIRRE
        - ERST

    SignatureTypeEnum:
      type: string
      enum:
        - SIGNATURE
        - PROCURATION

    SignatureRelationTypeEnum:
      type: string
      enum:
        - ALONE
        - JOINTLY
        - INCONCLUSIVE

    SignatureConclusionTypeEnum:
      type: string
      enum:
        - POSITIVE
        - NEGATIVE
        - INCONCLUSIVE

    IdRightsResponseTypesEnum:
      type: string
      enum:
        - PASS
        - FAIL
        - DATA

    Result:
      type: object

  securitySchemes:
    idRightsAuth:
      type: oauth2
      description: API authentication
      flows:
        clientCredentials:
          tokenUrl: /api-auth-server/token
          refreshUrl: /api-auth-server/refresh
          scopes: {}

servers:
  - description: Dev (for internal use)
    url: https://www-dev-id-rights.bbsas.no/idrights/v1
  - description: Preprod (for customer test)
    url: https://order.id-rights-preprod1.nets.eu/idrights/v1
  - description: Production
    url: https://order.idrights.nets.eu/idrights/v1