swagger: "2.0"
info:
  description: |
    This API specification is describing partner APIs provided by Global Payments Marketplace.
    It is available in different formats including as Open API YAML specification.
  version: "1.8"
  title: "Marketplace Partner APIs"
  contact:
    email: "apiteam@mygp.global"
  license:
    name: "Global Payments Marketplace Partner Agreement 1.0"
    url: "https://mygp.cz/agreements/marketplace-partner-agreement-1.0"
basePath: "/v1"
tags:
- name: "kpi sets"
  description: "Access to anonymised KPI data sets."
- name: "targeted offers"
  description: "Management of targeted offers submitted by the partner."
- name: "catalog"
  description: "Access to product and offer specifications."
- name: "subscriptions"
  description: "Management of subscription information for partner products."
- name: "companies"
  description: "Part of Acquiring API, providing access to data about onboarded companies."
- name: "locations"
  description: "Part of Acquiring API, providing access to data about active locations (outlets and gateways)."
- name: "terminals"
  description: "Part of Acquiring API, providing access to data about active terminals."
- name: "persons"
  description: "Part of Acquiring API, providing access to data about persons."
- name: "accounts"
  description: "Part of Acquiring API, providing access to data about active bank accounts."
- name: "user profiles"
  description: "Access to user profile information."
- name: "consent management"
schemes:
- "https"
paths:
  /kpi-sets:
    get:
      tags:
      - "kpi sets"
      summary: "Retrieve list of available KPI data set identifiers."
      description: |
        This endpoint provides access to the collection of available KPI set identifiers - where each KPI set is
        uniquely identified with a **year**-**month** (e.g. 2019-06 for June 2019) combination.
      operationId: "getKpiSets"
      produces:
      - "application/json"
      parameters:
      - in: "query"
        name: "limit"
        type: integer
        description: "Maximum number of results to be returned by the operation. Must be greater than 1 and less or equal to 100."
        required: false
        default: 20
      - in: "query"
        name: "offset"
        type: integer
        description: "Starting point of the first result to be returned by the operation. Zero based."
        required: false
        default: 0        
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/KpiSetIndices"
      security:
      - mygp_auth:
        - "read_kpi_sets"
  /kpi-sets/{kpi_set_id}:
    get:
      tags:
      - "kpi sets"
      summary: "Get data points for the selected KPI data set."
      description: |
        KPI data sets are collections of data that describe business performance of companies in specific month. A KPI set consists of **all** available data points for the particular month.
        The API uses pagination to allow for incremental retrieval of KPI set items. Maximum number of items returned in a single response is restricted to 100. The client however can adjust this to any value between 1 and 100.
      operationId: "getKpiSetById"
      produces:
      - "application/json"
      parameters:
      - name: "kpi_set_id"
        in: "path"
        description: "Identifier of the target KPI data set. Must have the form of YYYY-MM."
        required: true
        type: "string"
      - in: "query"
        name: "limit"
        type: integer
        description: "Maximum number of results to be returned by the operation. Must be greater than 1 and less or equal to 100."
        required: false
        default: 20
      - in: "query"
        name: "offset"
        type: integer
        description: "Starting point of the first result to be returned by the operation. Zero based."
        required: false
        default: 0
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/KpiSet"
        400:
          description: "Bad request"
          schema:
            $ref: "#/definitions/ApiResponse"
      security:
      - mygp_auth:
        - "read_kpi_sets"
  /targeted-offers/{company_key}:
    get:
      tags:
      - "targeted offers"
      summary: "Get list of targeted offers created for the company."
      description: |
        The list includes OPEN, ACCEPTED, LAPSED and REVOKED offers. The order of results is from the most recent offer to the oldest offer on record. Results are paginated.
      operationId: "getTargetedOffersForAnonymousCompany"
      produces:
      - "application/json"
      parameters:
      - name: "company_key"
        in: "path"
        description: "Company key provided as part of anonymised data set."
        required: true
        type: "string"
      - in: "query"
        name: "limit"
        type: integer
        description: "Maximum number of results to be returned by the operation. Must be greater than 1 and less or equal to 100."
        required: false
        default: 20
      - in: "query"
        name: "offset"
        type: integer
        description: "Starting point of the first result to be returned by the operation. Zero based."
        required: false
        default: 0
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/GetTargetedOffersResponse"
        400:
          description: "bad request"
          schema:
            $ref: "#/definitions/ApiResponse"
        404:
          description: "target resource does not exist"
          schema:
            $ref: "#/definitions/ApiResponse"
      security:
      - mygp_auth:
        - "manage_targeted_offers"
    post:
      tags:
      - "targeted offers"
      summary: "Create new targeted offer for company."
      description: |
        New targeted offer record is created for the company. Existing offersare not affected.
      operationId: "createTargetedOfferForAnonymousCompany"
      produces:
      - "application/json"
      parameters:
      - name: "company_key"
        in: "path"
        description: "Company key provided as part of anonymised data set."
        required: true
        type: "string"
      - name: "offer"
        in: "body"
        required: true
        schema:
          $ref: "#/definitions/CreateTargetedOfferRequest"
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/ApiResponse"
        400:
          description: "bad request"
          schema:
            $ref: "#/definitions/ApiResponse"
        404:
          description: "target resource does not exist"
          schema:
            $ref: "#/definitions/ApiResponse"
      security:
      - mygp_auth:
        - "manage_targeted_offers"
  /targeted-offers/{company_key}/{offer_id}:
    get:
      tags:
      - "targeted offers"
      summary: "Get details on specific targeted offer for company."
      description: |
        Returns complete details about specific targeted offer.
      operationId: "getTargetedOfferForAnonymousCompany"
      produces:
      - "application/json"
      parameters:
      - name: "company_key"
        in: "path"
        description: "Company key provided as part of anonymised data set."
        required: true
        type: "string"
      - name: "offer_id"
        in: "path"
        description: "Offer ID provided and assigned at the time of creation."
        required: true
        type: "string"
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/GetTargetedOfferResult"
        404:
          description: "target resource does not exist"
          schema:
            $ref: "#/definitions/ApiResponse"
      security:
      - mygp_auth:
        - "manage_targeted_offers"
    put:
      tags:
      - "targeted offers"
      summary: "Update existing targeted offer for company."
      description: |
        Some updates may be prevented by the server if they would create a violation of business rules. Update can only be performed for targeted offers with status **OPEN**. Start of valid period cannot be changed if the **validFrom** date has already passed. End of valid period cannot be moved closer if the **validFrom** date has already passed. Offering schema (**productRef**) cannot be changed with this operation, but properties inside of offer **parameters** payload can be modified.
      operationId: "updateTargetedOfferForAnonymousCompany"
      produces:
      - "application/json"
      parameters:
      - name: "company_key"
        in: "path"
        description: "Company key provided as part of anonymised data set."
        required: true
        type: "string"
      - name: "offer_id"
        in: "path"
        description: "Offer ID provided and assigned at the time of creation."
        required: true
        type: "string"
      - name: "offer"
        in: "body"
        required: true
        schema:
          $ref: "#/definitions/UpdateTargetedOfferRequest"
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/ApiResponse"
        400:
          description: "bad request"
          schema:
            $ref: "#/definitions/ApiResponse"
        404:
          description: "target resource does not exist"
          schema:
            $ref: "#/definitions/ApiResponse"
      security:
      - mygp_auth:
        - "manage_targeted_offers"
    delete:
      tags:
      - "targeted offers"
      summary: "Revokes existing targeted offer with immediate effect."
      description: ""
      operationId: "deleteTargetedOfferForAnonymousCompany"
      produces:
      - "application/json"
      parameters:
      - name: "company_key"
        in: "path"
        description: "Anonymised ID of the company."
        required: true
        type: "string"
      - name: "offer_id"
        in: "path"
        description: "Unique ID of the targeted offer."
        required: true
        type: "string"
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/ApiResponse"
        404:
          description: "target resource does not exist"
          schema:
            $ref: "#/definitions/ApiResponse"
      security:
      - mygp_auth:
        - "manage_targeted_offers"
  /catalog:
    get:
      tags:
      - "catalog"
      summary: "Get list of available product-offer specifications."
      description: |
        Returns list of product-offer specifications that are available to the partner. Results are paginated.
      operationId: "getCatalogProductOffers"
      produces:
      - "application/json"
      parameters:
      - in: "query"
        name: "limit"
        type: integer
        description: "Maximum number of results to be returned by the operation. Must be greater than 1 and less or equal to 100."
        required: false
        default: 20
      - in: "query"
        name: "offset"
        type: integer
        description: "Starting point of the first result to be returned by the operation. Zero based."
        required: false
        default: 0
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/GetCatalogProductOffersResponse"
        404:
          description: "target resource does not exist"
          schema:
            $ref: "#/definitions/ApiResponse"
      security:
      - mygp_auth:
        - "manage_targeted_offers"
  /catalog/{specification_id}:
    get:
      tags:
      - "catalog"
      summary: "Get details about available product-offer specification."
      description: |
        Returns detailed information about specific product-offer specifications that is available to the partner.
      operationId: "getCatalogProductOfferSpec"
      produces:
      - "application/json"
      parameters:
      - in: "path"
        name: "specification_id"
        type: string
        description: "Slug or id of target product-offer specification"
        required: true
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/CatalogProductOfferResponse"
      security:
      - mygp_auth:
        - "manage_targeted_offers"
  /subscriptions/{subscription_id}:
    get:
      tags:
        - "subscriptions"
      summary: "Get details about specific subscription."
      description: |
        Returns detailed information about specific subscription to a partner product.
      operationId: "getSubscriptionDetailsById"
      produces:
        - "application/json"
      parameters:
      - in: "path"
        name: "subscription_id"
        type: "string"
        description: "Id of the target subscription"
        required: true
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/SubscriptionInfo"
        400:
          description: "request did not pass validation"
          schema:
            $ref: "#/definitions/ApiResponse"
        401:
          description: "authentication credentials (JWT token) were missing or could not be validated"
          schema:
            $ref: "#/definitions/ApiResponse"
        403:
          description: "authentication credentials do not carry required authorisation"
          schema:
            $ref: "#/definitions/ApiResponse"
        404:
          description: "target subscription record could not be located/retrieved by the GPM system"
          schema:
            $ref: "#/definitions/ApiResponse"
    put:
      tags:
        - "subscriptions"
      summary: "Update details for selected subscription"
      description: |
        Updates details for specific subscription with information provided by the partner system.
      operationId: "updateSubscriptionDetailsById"
      produces:
        - "application/json"
      parameters:
      - in: "path"
        name: "subscription_id"
        type: "string"
        description: "Id of the target subscription"
        required: true
      - name: "info"
        in: "body"
        required: true
        schema:
          $ref: "#/definitions/SubscriptionUpdateRequest"
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/ApiResponse"
        400:
          description: "request did not pass validation"
          schema:
            $ref: "#/definitions/ApiResponse"
        401:
          description: "authentication credentials (JWT token) were missing or could not be validated"
          schema:
            $ref: "#/definitions/ApiResponse"
        403:
          description: "authentication credentials do not carry required authorisation"
          schema:
            $ref: "#/definitions/ApiResponse"
        404:
          description: "target subscription record could not be located/retrieved by the GPM system"
          schema:
            $ref: "#/definitions/ApiResponse"
        422:
          description: "request is valid but cannot be accepted due to a conflict on the GPM system"
          schema:
            $ref: "#/definitions/ApiResponse"
  /companies:
    get:
      tags:
        - "companies"
      summary: "List companies"
      description:
        Returns paginated collection of company records.
      operationId: "getCompanies"
      parameters:
      - in: "query"
        name: "modified_since"
        type: "string"
        format: "datetime"
        description: "ISO 8061 formatted date time value ('2021-09-20 13:15:20'); response will only include records that were modified after given point in time"
        required: false
      produces:
        - "application/json"
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/GetCompaniesResponse"
        401:
          description: "authentication credentials (JWT token) were missing or could not be validated"
          schema:
            $ref: "#/definitions/ApiResponse"
        403:
          description: "authentication credentials do not carry required authorisation"
          schema:
            $ref: "#/definitions/ApiResponse"
  /companies/{business_id}:
    get:
      tags:
        - "companies"
      summary: "Get details about specific company."
      description: |
        Returns detailed information about specific merchant company.
      operationId: "getCompanyDetails"
      produces:
        - "application/json"
      parameters:
      - in: "path"
        name: "business_id"
        type: "string"
        description: "Company business ID"
        required: true
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/CompanyInfo"
        401:
          description: "authentication credentials (JWT token) were missing or could not be validated"
          schema:
            $ref: "#/definitions/ApiResponse"
        403:
          description: "authentication credentials do not carry required authorisation"
          schema:
            $ref: "#/definitions/ApiResponse"
        404:
          description: "target merchant company cannot be located/retrieved"
          schema:
            $ref: "#/definitions/ApiResponse"
  /companies/{business_id}/locations:
    get:
      tags:
        - "companies"
      summary: "Get list of active locations for selected company"
      description: |
        Returns list of active locations for selected merchant company.
      operationId: "getLocationsForCompany"
      produces:
        - "application/json"
      parameters:
      - in: "path"
        name: "business_id"
        type: "string"
        description: "Company business ID"
        required: true
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/GetLocationsForCompanyResponse"
        401:
          description: "authentication credentials (JWT token) were missing or could not be validated"
          schema:
            $ref: "#/definitions/ApiResponse"
        403:
          description: "authentication credentials do not carry required authorisation"
          schema:
            $ref: "#/definitions/ApiResponse"
        404:
          description: "target merchant company cannot be located/retrieved"
          schema:
            $ref: "#/definitions/ApiResponse"
  /companies/{business_id}/persons:
    get:
      tags:
        - "companies"
      summary: "Get list of active persons for selected company"
      description: |
        Returns list of active persons for selected merchant company.
      operationId: "getPersonsForCompany"
      produces:
        - "application/json"
      parameters:
        - in: "path"
          name: "business_id"
          type: "string"
          description: "Company business ID"
          required: true
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/GetPersonsForCompanyResponse"
        401:
          description: "authentication credentials (JWT token) were missing or could not be validated"
          schema:
            $ref: "#/definitions/ApiResponse"
        403:
          description: "authentication credentials do not carry required authorisation"
          schema:
            $ref: "#/definitions/ApiResponse"
        404:
          description: "target merchant company cannot be located/retrieved"
          schema:
            $ref: "#/definitions/ApiResponse"
  /companies/{business_id}/subscriptions:
    get:
      tags:
        - "companies"
      summary: "Get list of active VAS subscriptions for selected company"
      description: |
        Returns list of active subscriptions for selected merchant company.
      operationId: "getSubscriptionsForCompany"
      produces:
        - "application/json"
      parameters:
      - in: "path"
        name: "business_id"
        type: "string"
        description: "Company business ID"
        required: true
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/GetSubscriptionsForCompanyResponse"
        401:
          description: "authentication credentials (JWT token) were missing or could not be validated"
          schema:
            $ref: "#/definitions/ApiResponse"
        403:
          description: "authentication credentials do not carry required authorisation"
          schema:
            $ref: "#/definitions/ApiResponse"
        404:
          description: "target merchant company cannot be located/retrieved"
          schema:
            $ref: "#/definitions/ApiResponse"
  /locations:
    get:
      tags:
        - "locations"
      summary: "List companies"
      description:
        Returns paginated collection of location records.
      operationId: "getLocations"
      parameters:
      - in: "query"
        name: "modified_since"
        type: "string"
        format: "datetime"
        description: "ISO 8061 formatted date time value ('2021-09-20 13:15:20'); response will only include records that were modified after given point in time"
        required: false
      produces:
        - "application/json"
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/GetLocationsResponse"
        401:
          description: "authentication credentials (JWT token) were missing or could not be validated"
          schema:
            $ref: "#/definitions/ApiResponse"
        403:
          description: "authentication credentials do not carry required authorisation"
          schema:
            $ref: "#/definitions/ApiResponse"
  /locations/{mid}:
    get:
      tags:
        - "locations"
      summary: "Get details about specific location."
      description: |
        Returns detailed information about specific merchant location (outlet or e-commerce).
      operationId: "getLocationDetails"
      produces:
        - "application/json"
      parameters:
      - in: "path"
        name: "mid"
        type: "string"
        description: "Location number"
        required: true
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/LocationInfo"
        400:
          description: "target merchant location number has multiple locations"
          schema:
            $ref: "#/definitions/ApiResponse"
        401:
          description: "authentication credentials (JWT token) were missing or could not be validated"
          schema:
            $ref: "#/definitions/ApiResponse"
        403:
          description: "authentication credentials do not carry required authorisation"
          schema:
            $ref: "#/definitions/ApiResponse"
        404:
          description: "target merchant location could not be located/retrieved"
          schema:
            $ref: "#/definitions/ApiResponse"
  /locations/{mid}/terminals:
    get:
      tags:
        - "locations"
      summary: "Get list of active terminals for selected location"
      description: |
        Returns list of active terminals for selected merchant location (outlet or ecommerce).
      operationId: "getTerminalsForLocation"
      produces:
        - "application/json"
      parameters:
      - in: "path"
        name: "mid"
        type: "string"
        description: "Location number"
        required: true
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/GetTerminalsForLocationResponse"
        401:
          description: "authentication credentials (JWT token) were missing or could not be validated"
          schema:
            $ref: "#/definitions/ApiResponse"
        403:
          description: "authentication credentials do not carry required authorisation"
          schema:
            $ref: "#/definitions/ApiResponse"
        404:
          description: "target merchant location cannot be located/retrieved"
          schema:
            $ref: "#/definitions/ApiResponse"
  /terminals:
    get:
      tags:
        - "terminals"
      summary: "List terminals"
      description:
        Returns paginated collection of terminal records.
      operationId: "getTerminals"
      parameters:
      - in: "query"
        name: "modified_since"
        type: "string"
        format: "datetime"
        description: "ISO 8061 formatted date time value ('2021-09-20 13:15:20'); response will only include records that were modified after given point in time"
        required: false
      produces:
        - "application/json"
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/GetTerminalsResponse"
        401:
          description: "authentication credentials (JWT token) were missing or could not be validated"
          schema:
            $ref: "#/definitions/ApiResponse"
        403:
          description: "authentication credentials do not carry required authorisation"
          schema:
            $ref: "#/definitions/ApiResponse"
  /terminals/{terminal_number}:
    get:
      tags:
        - "terminals"
      summary: "Get details about specific payment terminal."
      description: |
        Returns detailed information about specific payment terminal.
      operationId: "getTerminalDetails"
      produces:
        - "application/json"
      parameters:
      - in: "path"
        name: "terminal_number"
        type: "string"
        description: "Number of the target payment terminal"
        required: true
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/TerminalInfo"
        400:
          description: "target payment terminal number has multiple terminals"
          schema:
            $ref: "#/definitions/ApiResponse"
        401:
          description: "authentication credentials (JWT token) were missing or could not be validated"
          schema:
            $ref: "#/definitions/ApiResponse"
        403:
          description: "authentication credentials do not carry required authorisation"
          schema:
            $ref: "#/definitions/ApiResponse"
        404:
          description: "target payment terminal record could not be located/retrieved"
          schema:
            $ref: "#/definitions/ApiResponse"
  /persons:
    get:
      tags:
        - "persons"
      summary: "List persons"
      description:
        Returns paginated collection of company records.
      operationId: "getPersons"
      parameters:
      - in: "query"
        name: "modified_since"
        type: "string"
        format: "datetime"
        description: "ISO 8061 formatted date time value ('2021-09-20 13:15:20'); response will only include records that were modified after given point in time"
        required: false
      produces:
        - "application/json"
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/GetPersonsResponse"
        401:
          description: "authentication credentials (JWT token) were missing or could not be validated"
          schema:
            $ref: "#/definitions/ApiResponse"
        403:
          description: "authentication credentials do not carry required authorisation"
          schema:
            $ref: "#/definitions/ApiResponse"
  /persons/{person_id}:
    get:
      tags:
        - "persons"
      summary: "Get details about specific person."
      description: |
        Returns detailed information about specific person.
      operationId: "getPersonDetails"
      produces:
        - "application/json"
      parameters:
      - in: "path"
        name: "person_id"
        type: "string"
        description: "ID of the target person record"
        required: true
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/GetPersonDetailsResponse"
        401:
          description: "authentication credentials (JWT token) were missing or could not be validated"
          schema:
            $ref: "#/definitions/ApiResponse"
        403:
          description: "authentication credentials do not carry required authorisation"
          schema:
            $ref: "#/definitions/ApiResponse"
        404:
          description: "target person record could not be located/retrieved"
          schema:
            $ref: "#/definitions/ApiResponse"
  /persons/{person_id}/consents:
    post:
      tags:
        - "consent management"
      summary: "Update marketing consents for specific person."
      description: |
        Updates makreting consent decisions for specific person.
      operationId: "updateConsents"
      produces:
        - "application/json"
      parameters:
      - in: "path"
        name: "person_id"
        type: "string"
        description: "ID of the target person record"
        required: true
      - name: "offer"
        in: "body"
        required: true
        schema:
          $ref: "#/definitions/UpdateConsentsRequest"
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/UpdateConsentsResponse"
        400:
          description: "bad request"
          schema:
            $ref: "#/definitions/ApiResponse"
        401:
          description: "authentication credentials (JWT token) were missing or could not be validated"
          schema:
            $ref: "#/definitions/ApiResponse"
        403:
          description: "authentication credentials do not carry required authorisation"
          schema:
            $ref: "#/definitions/ApiResponse"
        404:
          description: "target person record could not be located/retrieved"
          schema:
            $ref: "#/definitions/ApiResponse"
  /accounts:
    get:
      tags:
        - "accounts"
      summary: "List accounts"
      description:
        Returns paginated collection of account records.
      operationId: "getAccounts"
      parameters:
      - in: "query"
        name: "modified_since"
        type: "string"
        format: "datetime"
        description: "ISO 8061 formatted date time value ('2021-09-20 13:15:20'); response will only include records that were modified after given point in time"
        required: false
      produces:
        - "application/json"
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/GetAccountsResponse"
        401:
          description: "authentication credentials (JWT token) were missing or could not be validated"
          schema:
            $ref: "#/definitions/ApiResponse"
        403:
          description: "authentication credentials do not carry required authorisation"
          schema:
            $ref: "#/definitions/ApiResponse"
  /user-profiles/self:
    get:
      tags:
        - "user profiles"
      summary: "Get details user profile for current user."
      description: |
        Returns user profile information for current user, authenticated through the acess token.
      operationId: "getProfileForCurrentUser"
      produces:
        - "application/json"
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/UserProfileInfo"
        400:
          description: "no business was selected by the user"
          schema:
            $ref: "#/definitions/ApiResponse"
        401:
          description: "authentication credentials (JWT token) were missing or could not be validated"
          schema:
            $ref: "#/definitions/ApiResponse"
        403:
          description: "authentication credentials do not carry required authorisation"
          schema:
            $ref: "#/definitions/ApiResponse"
        404:
          description: "user profile could not be located/retrieved"
          schema:
            $ref: "#/definitions/ApiResponse"
securityDefinitions:
  mygp_auth:
    type: "oauth2"
    tokenUrl: "https://mygp.global/auth/realms/gpe/protocol/openid-connect/token"
    flow: "application"
    scopes:
      read_kpi_sets: "read KPI sets"
      manage_targeted_offers: "manage targeted offers"
definitions:
  KpiSetIndex:
    type: "object"
    properties:
      id:
        type: "string"
      created:
        type: "string"
        format: "date-time"
      modified:
        type: "string"
        format: "date-time"
  KpiSetIndices:
    type: "object"
    properties:
      count:
        type: "integer"
        format: "int64"
        example: 15
      next:
        type: "string"
        format: "url"
        example: "https://api.mygp.cz/v1/kpi-sets?limit=10&offset=10"
      previous:
        type: "string"
        format: "url"
        example: null
      results:
        type: "array"
        items:
          $ref: "#/definitions/KpiSetIndex"
        example:
          - id: "2019-06"
            created: '2019-07-01T01:00:00.000Z'
            modified: '2019-07-01T01:00:00.000Z'
            self: 'https://api.mygp.cz/v1/kpi-sets/2019-06'
          - id: "2019-05"
            created: '2019-06-01T01:00:00.000Z'
            modified: '2019-06-05T08:33:22.111Z'
            self: 'https://api.mygp.cz/v1/kpi-sets/2019-05'
          - id: "2019-04"
            created: '2019-05-01T01:00:00.000Z'
            modified: '2019-05-01T01:00:00.000Z'
            self: 'https://api.mygp.cz/v1/kpi-sets/2019-04'
          - id: "2019-03"
            created: '2019-04-01T01:00:00.000Z'
            modified: '2019-04-01T01:00:00.000Z'
            self: 'https://api.mygp.cz/v1/kpi-sets/2019-03'
          - id: "2019-02"
            created: '2019-03-01T01:00:00.000Z'
            modified: '2019-03-01T01:00:00.000Z'
            self: 'https://api.mygp.cz/v1/kpi-sets/2019-02'
          - id: "2019-01"
            created: '2019-02-01T01:00:00.000Z'
            modified: '2019-02-01T01:00:00.000Z'
            self: 'https://api.mygp.cz/v1/kpi-sets/2019-01'
          - id: "2018-12"
            created: '2019-01-01T01:00:00.000Z'
            modified: '2019-01-01T01:00:00.000Z'
            self: 'https://api.mygp.cz/v1/kpi-sets/2018-12'
          - id: "2018-11"
            created: '2018-12-01T01:00:00.000Z'
            modified: '2018-12-01T01:00:00.000Z'
            self: 'https://api.mygp.cz/v1/kpi-sets/2018-11'
          - id: "2018-10"
            created: '2018-11-01T01:00:00.000Z'
            modified: '2018-11-01T01:00:00.000Z'
            self: 'https://api.mygp.cz/v1/kpi-sets/2018-10'
          - id: "2018-09"
            created: '2018-10-01T01:00:00.000Z'
            modified: '2018-10-01T01:00:00.000Z'
            self: 'https://api.mygp.cz/v1/kpi-sets/2018-09'
  KpiSet:
    type: "object"
    properties:
      count:
        type: "integer"
        format: "int64"
        example: 11
      next:
        type: "string"
        format: "url"
        example: null
      previous:
        type: "string"
        format: "url"
        example: "https://api.mygp.cz/v1/kpi-sets/2019-06?limit=10&offset=0"
      results:
        type: "array"
        items:
          $ref: "#/definitions/AnonymisedKpiSnapshot"
  AnonymisedKpiSnapshot:
    type: "object"
    description: |
      An object describing a point-in-time KPI snapshot for specific company.
    properties:
      company_key:
        type: "string"
        example: "F53CFC9E103659533996DDBE53F8E4E2"
      company_ud:
        type: "string"
        example: "COMP-140692"
      mid:
        type: "string"
        example: "MPLLOC000000000000057"
      snapshot_date:
        type: "string"
        format: "date"
      currency:
        type: "string"
        example: "EUR"
      number_of_transactions:
        type: "integer"
        example: 665
      turnover:
        type: "string"
        format: "decimal"
        example: "234525.26"
      number_of_won_disputes:
        type: "integer"
        example: 7
      value_of_won_disputes:
        type: "string"
        format: "decimal"
        example: "1355.70"
      number_of_lost_disputes:
        type: "integer"
        example: 1
      value_of_lost_disputes:
        type: "string"
        format: "decimal"
        example: "268.90"
      country_code:
        type: "string"
        example: "SK"
      company_active_from:
        type: "string"
        format: "date"
        example: "2016-03-17"
      company_legal_form:
        type: "string"
        example: "sro"
      mid_active_from:
        type: "string"
        format: "date"
        example: "2016-03-17"
      mid_mcc_code:
        type: "string"
        example: "7891"
      mid_mcc_text:
        type: "string"
        example: "Hotels"
      acquirer_code:
        type: "string"
        example: "70301"
        description: |
          Identifies the acquirer organisation using a permanent and unique code (combined from ISO-3166-1 numeric
          code for the country and a sequence number).

          * 00000 for unknown acquirer organisation (indicates data issue)
          * 20301 for JV Czech Republic
          * 70301 for JV Slovakia

  TargetedOfferStatus:
    type: "string"
    example: "OPEN"
    enum:
      - OPEN
      - ACCEPTED
      - LAPSED
      - REVOKED
  TargetedOfferInfo:
    type: "object"
    properties:
      id:
        type: "string"
        example: "O93730028"
      status:
        $ref: "#/definitions/TargetedOfferStatus"
      valid_from:
        type: "string"
        format: "date"
        example: "2019-06-01"
      valid_until:
        type: "string"
        format: "date"
        example: "2019-06-30"
      created:
        type: "string"
        format: "date-time"
      modified:
        type: "string"
        format: "date-time"
  GetTargetedOffersResponse:
    type: "object"
    properties:
      count:
        type: "integer"
        format: "int64"
        example: 6
        description: "Total number of results available to retrieve."
      next:
        type: "string"
        format: "url"
        example: null
        description: "URL to retrieve next batch of results."
      previous:
        type: "string"
        format: "url"
        example: "null"
        description: "URL to retrieve previous batch of results."
      results:
        type: "array"
        items:
          $ref: "#/definitions/TargetedOfferInfo"
        example: 
          - id: "O93730028"
            status: "OPEN"
            valid_from: "2019-06-22"
            valid_until: "2019-06-30"
            created: "2019-06-21T09:55:32.113Z"
            modified: "2019-06-21T09:55:32.113Z"
          - id: "O93730016"
            status: "REVOKED"
            valid_from: "2019-06-01"
            valid_until: "2019-06-30"
            created: "2019-05-30T08:20:25.567Z"
            modified: "2019-06-21T09:55:31.348Z"            
          - id: "O93730003"
            status: "LAPSED"
            valid_from: "2019-05-01"
            valid_until: "2019-05-31"
            created: "2019-04-29T08:16:55.138Z"
            modified: "2019-04-29T08:16:55.138Z"
          - id: "O93729971"
            status: "LAPSED"
            valid_from: "2019-04-01"
            valid_until: "2019-04-30"
            created: "2019-03-30T09:55:12.231Z"
            modified: "2019-03-30T09:55:12.231Z"
          - id: "O93729964"
            status: "LAPSED"
            valid_from: "2019-03-01"
            valid_until: "2019-03-30"
            created: "2019-02-27T09:23:27.831Z"
            modified: "2019-02-27T09:23:27.831Z"
          - id: "O93729950"
  CreateTargetedOfferRequest:
    type: "object"
    properties:
      offer_id:
        type: "string"
        example: "O93730028"
        description: "Arbitrary offer ID that can be used by the submitting partner to uniquely identify the offer."
      valid_from:
        type: "string"
        format: "date"
        example: "2019-06-01"
        description: "The earliest date when the offer can be accepted by the customer."
      valid_until:
        type: "string"
        format: "date"
        example: "2019-06-30"
        description: "The last date when offer can be accepted by the customer."
      product_ref:
        type: "string"
        example: "flexible-financing-offer#v1"
        description: "Identifies product-offer schema to be used for validation of parameters payload."
      parameters:
        type: "object"
        description: "Container for offer-specific payload."        
        example:
          offered_amount: "700000.00"
          maximum_amount: "700000.00"
          total_amount: "763000.00"
          currency: "CZK"
          factor_rate: "1.09"
          term: "4"
  UpdateTargetedOfferRequest:
    type: "object"
    properties:
      valid_from:
        type: "string"
        format: "date"
        example: "2019-06-01"
        description: "The earliest date when the offer can be accepted by the customer."
      valid_until:
        type: "string"
        format: "date"
        example: "2019-06-30"
        description: "The last date when offer can be accepted by the customer."
      parameters:
        type: "object"
        description: "Container for offer-specific payload."        
        example:
          offered_amount: "700000.00"
          maximum_amount: "700000.00"
          total_amount: "763000.00"
          currency: "CZK"
          factor_rate: "1.09"
          term: "4"          
  GetTargetedOfferResult:
    type: "object"
    properties:
      offer_id:
        type: "string"
        example: "O93730028"
        description: "Arbitrary offer ID that can be used by the submitting partner to uniquely identify the offer."
      valid_from:
        type: "string"
        format: "date"
        example: "2019-06-01"
        description: "The earliest date when the offer can be accepted by the customer."
      valid_until:
        type: "string"
        format: "date"
        example: "2019-06-30"
        description: "The last date when offer can be accepted by the customer."
      product_ref:
        type: "string"
        example: "flexible-financing#v1"
        description: "Identifies product specification to be used for validation of parameters payload."
      parameters:
        type: "object"
        description: "Container for product-specific offer payload."        
        example:
          offered_amount: "700000.00"
          maximum_amount: "700000.00"
          total_amount: "763000.00"
          currency: "CZK"
          factor_rate: "1.09"
          term: "4"
      status:
        type: "string"
        enum:
          - OPEN
          - ACCEPTED
          - LAPSED
          - REVOKED
      created:
        type: "string"
        format: "date-time"
      modified:
        type: "string"
        format: "date-time"
  GetCatalogProductOffersResponse:
    type: "object"
    properties:
      count:
        type: "integer"
        format: "int64"
        example: 1
        description: "Total number of results available to retrieve."
      next:
        type: "string"
        format: "url"
        example: null
        description: "URL to retrieve next batch of results."
      previous:
        type: "string"
        format: "url"
        example: null
        description: "URL to retrieve previous batch of results."
      results:
        type: "array"
        description: "Collection of results retrieved with this batch."
        items:
          $ref: "#/definitions/CatalogProductOfferRef"
        example:
          - id: "79b63426-94e1-11e9-bb23-c3d8a01a3776"
            slug: "flexible-financing-v1"
            status: "PUBLISHED"
            created: "2019-01-01T06:00:00.000Z"
            modified: "2019-03-15T09:30:00.000Z"
  CatalogProductOfferRef:
    type: "object"
    properties:
      id:
        type: "string"
        format: "uuid"
        example: "79b63426-94e1-11e9-bb23-c3d8a01a3776"
      slug:
        type: "string"
        example: "flexible-financing-v1"
      status:
        type: "string"
        enum:
          - PLANNED
          - PUBLISHED
          - RETIRED
        example: "PUBLISHED"
      created:
        type: "string"
        format: "date-time"
        example: "2019-01-01T06:00:00.000Z"
      modified:
        type: "string"
        format: "date-time"
        example: "2019-03-15T09:30:00.000Z"
  CatalogProductOfferResponse:
    type: "object"
    properties:
      id:
        type: "string"
        format: "uuid"
        example: "79b63426-94e1-11e9-bb23-c3d8a01a3776"
      slug:
        type: "string"
        example: "flexible-financing-v1"
      status:
        type: "string"
        enum:
          - PLANNED
          - PUBLISHED
          - RETIRED
        example: "PUBLISHED"
      created:
        type: "string"
        format: "date-time"
        example: "2019-01-01T06:00:00.000Z"
      modified:
        type: "string"
        format: "date-time"
        example: "2019-03-15T09:30:00.000Z"
      schema:
        type: "object"
        description: "JSON schema describing expected structure of product-offer parameters."
        example:
          $schema: "http://json-schema.org/draft-07/schema#"
          $id: "https://api.mygp.cz/v1/catalog/flexible-financing-v1/schema.json"
          title: "flexible-financing-v1 product-offer schema"
          type: "object"
          properties:
            offered_amount:
              type: "string"
            maximum_amount:
              type: "string"
            total_amount:
              type: "string"
            currency:
              type: "string"
            factor_rate:
              type: "string"
            term:
              type: "string"
          required:
            - offered_amount
            - maximum_amount
            - total_amount
            - currency
            - factor_rate
            - term
  SubscriptionStatus:
    type: "string"
    example: "ACTIVE"
    enum:
      - ACTIVATING
      - ACTIVE
      - MODIFYING
      - CEASING
      - SUSPENDED
      - CEASED
      - PAUSED
  SubscriptionInfo:
    type: "object"
    properties:
      id:
        type: "string"
        example: "1CAC7410-744B-44F2-B02E-5C15710D3F0D"
      status:
        $ref: "#/definitions/SubscriptionStatus"
      created:
        type: "string"
        format: "date-time"
      modified:
        type: "string"
        format: "date-time"
      market:
        type: string
        example: "cz"
      offer_id:
        type: string
        example: "3BE2B9E5-4C5C-4ED3-9F93-925DD77C0214"
      capabilities:
        type: "array"
        description: "Collection of assigned capabilities"
        items:
          type: string
  SubscriptionUpdateRequest:
    type: "object"
    properties:
      status:
        description: "Status of the subscription as it is currently tracked in the partner system."
        example: "ACTIVE"
        $ref: "#/definitions/SubscriptionStatus"
      attributes:
        type: "object"
        description: "A JSON object with additional subscription properties submitted by the partner system. An empty object ( {} ) can be passed if no additional information is necessary or available."
        example:
          propertyA: "newValueA"
          propertyB: "newValueB"
  Address:
    type: "object"
    properties:
      street:
        type: "string"
        example: "V Olšinách"
      house:
        type: "string"
        example: "626/80"
      zip_code:
        type: "string"
        example: "10 100 00"
      city:
        type: "string"
        example: "Praha"
      country_code:
        type: "string"
        example: "CZ"
  SimpleServiceInfo:
    type: "object"
    properties:
      code:
        type: "string"
        example: "EET"
      status:
        type: "string"
        example: "ACTIVE"
        enum:
          - "ACTIVE"
          - "NOT_ACTIVE"
  TerminalInfo:
    type: "object"
    properties:
      terminal_number:
        type: "string"
        example: "12345678"
      mid:
        type: "string"
        example: "88587548578"
      business_id:
        type: "string"
        example: "7587485784"
      terminal_type:
        type: "string"
        example: "ICT220DTINTCL_ETH"
      receipt_rows:
        type: "array"
        items:
          type: "string"
        example:
          - "receipt row #1"
          - "receipt row #2"
          - "receipt row #3"
      activated:
        type: "string"
        format: "date"
        example: "2018-05-12"
      updated:
        type: "string"
        format: "date-time"
        example: "2020-09-27T10:16:12"
  ShortTerminalInfo:
    type: "object"
    properties:
      terminal_number:
        type: "string"
        example: "12345678"
      terminal_type:
        type: "string"
        example: "ICT220DTINTCL_ETH"
      activated:
        type: "string"
        format: "date"
        example: "2018-05-12"
      updated:
        type: "string"
        format: "date-time"
        example: "2020-09-27T10:16:12"
      self:
        type: "string"
        format: "url"
        example: "https://api.mygp.cz/v1/terminals/558848578"
  GetTerminalsForLocationResponse:
    type: "object"
    properties:
      count:
        type: "integer"
        format: "int64"
        example: 2
      next:
        type: "string"
        format: "url"
        example: "https://api.mygp.cz/v1/locations/88587548578/terminals?limit=10&offset=10"
      previous:
        type: "string"
        format: "url"
        example: null
      results:
        type: "array"
        items:
          $ref: "#/definitions/ShortTerminalInfo"
        example:
          - terminal_number: "1234567891"
            terminal_type: "ICT220DTINTCL_ETH"
            created: '2019-07-01'
            modified: '2019-07-01T01:00:00.000Z'
            self: 'https://api.mygp.cz/v1/terminals/1234567891'
          - terminal_number: "1234567892"
            terminal_type: "ICT220DTINTCL_ETH"
            created: '2019-10-12'
            modified: '2019-11-03T08:35:13.000Z'
            self: 'https://api.mygp.cz/v1/terminals/1234567892'
  LocationInfo:
    type: "object"
    properties:
      mid:
        type: "string"
        example: "88587548578"
      business_id:
        type: "string"
        example: "7587485784"
      location_type:
        type: "string"
        enum:
          - outlet
          - ecommerce
        example: "outlet"
      location_name:
        type: "string"
        example: "Main Street Shop"
      address:
        $ref: "#/definitions/Address"
      mcc:
        type: "string"
        example: "8012"
      services:
        type: "array"
        items:
          $ref: "#/definitions/SimpleServiceInfo"
        example:
          - code: eCommerce
            status: ACTIVE
          - code: easy2sell
            status: NOT_ACTIVE
          - code: DCC
            status: NOT_ACTIVE
          - code: gptom
            status: NOT_ACTIVE
      is_seasonal:
        type: "boolean"
        example: false
      variable_symbol_code:
        type: "string"
        example: "IVB"
      activated:
        type: "string"
        format: "date"
        example: "2018-05-12"
      updated:
        type: "string"
        format: "date-time"
        example: "2020-09-27T10:16:12"
  ShortLocationInfo:
    type: "object"
    properties:
      mid:
        type: "string"
        example: "558848578"
      location_type:
        type: "string"
        enum:
          - outlet
          - ecommerce
        example: "outlet"
      location_name:
        type: "string"
        example: "Main Street Shop"
      activated:
        type: "string"
        format: "date"
        example: "2018-05-12"
      updated:
        type: "string"
        format: "date-time"
        example: "2020-09-27T10:16:12"
      self:
        type: "string"
        format: "url"
        example: "https://api.mygp.cz/v1/locations/558848578"
  GetLocationsForCompanyResponse:
    type: "object"
    properties:
      count:
        type: "integer"
        format: "int64"
        example: 2
      next:
        type: "string"
        format: "url"
        example: "https://api.mygp.cz/v1/companies/7587485784/locations?limit=10&offset=10"
      previous:
        type: "string"
        format: "url"
        example: null
      results:
        type: "array"
        items:
          $ref: "#/definitions/ShortLocationInfo"
        example:
          - mid: "7587485784"
            location_name: "Main Street Shop"
            location_type: "outlet"
            created: '2019-07-01T01:00:00.000Z'
            modified: '2019-07-01T01:00:00.000Z'
            self: 'https://api.mygp.cz/v1/locations/7587485784'
          - mid: "6357485222"
            location_name: "www.mainstreetshop.com"
            location_type: "ecommerce"
            created: '2019-07-01T01:00:00.000Z'
            modified: '2019-07-01T01:00:00.000Z'
            self: 'https://api.mygp.cz/v1/locations/6357485222'
  CompanyInfo:
    type: "object"
    properties:
      business_id:
        type: "string"
        example: "7587485784"
      company_id:
        type: "string"
        example: "COMP-921533213"
      tax_id:
        type: "string"
        example: "CZ1234567890"
      country_code:
        type: "string"
        example: "CZ"
      language_code:
        type: "string"
        example: "CZ"
      company_name:
        type: "string"
        example: "Global Payments s.r.o."
      registered_address:
        $ref: "#/definitions/Address"
      contact_address:
        $ref: "#/definitions/Address"
      services:
        type: "array"
        items:
          $ref: "#/definitions/SimpleServiceInfo"
        example:
          - code: EET
            status: ACTIVE
          - code: MyGP
            status: NOT_ACTIVE
      sales_name:
        type: "string"
        example: "Felicity Decker"
      active:
        type: "boolean"
        example: true
      status:
        type: "string"
        example: ACTIVE
        enum:
          - NEW
          - ACTIVE
          - INACTIVE
      activated:
        type: "string"
        format: "date"
        example: "2018-05-12"
      closed:
        type: "string"
        format: "date"
        example: ""
      updated:
        type: "string"
        format: "date-time"
        example: "2020-09-27T10:16:12"
  ShortCompanyInfo:
    type: "object"
    properties:
      business_id:
        type: "string"
        example: "7587485784"
      company_id:
        type: "string"
        example: "COMP-00042341"
      tax_id:
        type: "string"
        example: "CZ12345678"
      company_name:
        type: "string"
        example: "Global Payments s.r.o."
      country_code:
        type: "string"
        example: "CZ"
      language_code:
        type: "string"
        example: "CZ"
      registered_address:
        $ref: "#/definitions/Address"
      contact_address:
        $ref: "#/definitions/Address"
      eet:
        type: "string"
        example: ACTIVE
        enum:
          - ACTIVE
          - NOT_INACTIVE
      mygp:
        type: "string"
        example: ACTIVE
        enum:
          - ACTIVE
          - NOT_INACTIVE
      sales_name:
        type: "string"
        example: "John Doe"
      status:
        type: "string"
        example: ACTIVE
        enum:
          - ACTIVE
          - NOT_INACTIVE
      active_since:
        type: "string"
        format: "date"
        example: "2018-05-12"
      active_until:
        type: "string"
        example: ""
      kyc_status:
        type: "string"
        example: COMPLETE
        enum:
          - COMPLETE
          - INCOMPLETE
      updated:
        type: "string"
        format: "date-time"
        example: "2020-09-27T10:16:12"
  GetCompaniesResponse:
    type: "object"
    properties:
      count:
        type: "integer"
        format: "int64"
        example: 2
      next:
        type: "string"
        format: "url"
        example: "https://api.mygp.cz/v1/companies?limit=10&offset=10"
      previous:
        type: "string"
        format: "url"
        example: null
      results:
        type: "array"
        items:
          $ref: "#/definitions/ShortCompanyInfo"
        example:
          - business_id: "7587485784"
            company_id: "COMP-00042341"
            tax_id: "CZ12345678"
            company_name: "Happy Koala Ltd."
            country_code: "CZ"
            language_code: "CZ"
            registered_address:
              street: "V Olšinách"
              house: "626/80"
              zip_code: "10 100 00"
              city: "Praha"
              country_code: "CZ"
            contact_address:
              street: "V Olšinách"
              house: "626/80"
              zip_code: "10 100 00"
              city: "Praha"
              country_code: "CZ"
            eet: "ACTIVE"
            mygp: "ACTIVE"
            sales_name: "John Doe"
            status: "ACTIVE"
            active_since: "2017-11-08"
            active_until: ""
            kyc_status: "COMPLETE"
            updated: '2019-07-01T01:00:00.000Z'
  GetLocationsResponse:
    type: "object"
    properties:
      count:
        type: "integer"
        format: "int64"
        example: 2
      next:
        type: "string"
        format: "url"
        example: "https://api.mygp.cz/v1/locations?limit=10&offset=10"
      previous:
        type: "string"
        format: "url"
        example: null
      results:
        type: "array"
        items:
          $ref: "#/definitions/ShortLocationInfo"
        example:
          - mid: "7587485784"
            location_name: "Main Street Shop"
            location_type: "outlet"
            created: '2019-07-01T01:00:00.000Z'
            modified: '2019-07-01T01:00:00.000Z'
            self: 'https://api.mygp.cz/v1/locations/7587485784'
          - mid: "6357485222"
            location_name: "www.mainstreetshop.com"
            location_type: "ecommerce"
            created: '2019-07-01T01:00:00.000Z'
            modified: '2019-07-01T01:00:00.000Z'
            self: 'https://api.mygp.cz/v1/locations/6357485222'
  GetTerminalsResponse:
    type: "object"
    properties:
      count:
        type: "integer"
        format: "int64"
        example: 2
      next:
        type: "string"
        format: "url"
        example: "https://api.mygp.cz/v1/terminals?limit=10&offset=10"
      previous:
        type: "string"
        format: "url"
        example: null
      results:
        type: "array"
        items:
          $ref: "#/definitions/ShortTerminalInfo"
        example:
          - terminal_number: "1234567891"
            terminal_type: "ICT220DTINTCL_ETH"
            created: '2019-07-01'
            modified: '2019-07-01T01:00:00.000Z'
            self: 'https://api.mygp.cz/v1/terminals/1234567891'
          - terminal_number: "1234567892"
            terminal_type: "ICT220DTINTCL_ETH"
            created: '2019-10-12'
            modified: '2019-11-03T08:35:13.000Z'
            self: 'https://api.mygp.cz/v1/terminals/1234567892'
  GetPersonsResponse:
    type: "object"
    properties:
      count:
        type: "integer"
        format: "int64"
        example: 1
      next:
        type: "string"
        format: "url"
        example: "https://api.mygp.cz/v1/persons?limit=10&offset=10"
      previous:
        type: "string"
        format: "url"
        example: null
      results:
        type: "array"
        items:
          $ref: "#/definitions/ShortPersonInfo"
        example:
          - id: "6573467568"
            salutation: "Mr"
            title_before: ""
            first_name: "James"
            last_name: "Kirk"
            title_after: ""
            phone: "+42012341234"
            email: "test@example.com"
            position: "Captain"
            birth_number: "1234567"
            id_number: "P3546359"
            id_type: "IDC"
            is_statutory: true
            is_owner: false
            status: "ACTIVE"
            active_since: "2020-07-11"
            active_until: ""
            invitation_url: "https://mygp.cz/onboarding/invitation/xyz123abc456"
  GetAccountsResponse:
    type: "object"
    properties:
      count:
        type: "integer"
        format: "int64"
        example: 1
      next:
        type: "string"
        format: "url"
        example: "https://api.mygp.cz/v1/accounts?limit=10&offset=10"
      previous:
        type: "string"
        format: "url"
        example: null
      results:
        type: "array"
        items:
          $ref: "#/definitions/ShortAccountInfo"
        example:
          - id: "6573467568"
            business_id: "99999991"
            account_type: "P"
            iban: "CZ2720100000002609999888"
            currency: "CZK"
            bank: "FIOBCZPP"
            status: "ACTIVE"
            active_since: "2020-07-11"
            active_until: ""
  GetSubscriptionsForCompanyResponse:
    type: "object"
    properties:
      count:
        type: "integer"
        format: "int64"
        example: 2
      next:
        type: "string"
        format: "url"
        example: "https://api.mygp.cz/v1/companies/432809567206/subscriptions?limit=10&offset=10"
        description: resource URL for the next batch of subscription records
      previous:
        type: "string"
        format: "url"
        example: null
        description: resource URL for the previous batch of subscription records
      results:
        type: "array"
        items:
          $ref: "#/definitions/ShortSubscriptionInfo"
        example:
          - id: "adcaac2d-26c0-4728-b2a9-4286bbd3e324"
            status: "ACTIVE"
            created: '2019-07-02T01:00:00.000Z'
            modified: '2019-07-02T01:00:00.000Z'
            offer_id: '6d5a1ef3-57fb-4739-abe7-fb1ecdac84af'
          - id: "fed2bd00-77f4-4346-a950-08d094c2a446"
            status: "ACTIVE"
            created: '2019-07-01T01:00:00.000Z'
            modified: '2019-07-01T01:00:00.000Z'
            offer_id: '645211e9-98db-48d7-a16c-768eb1d3db4a'
  ShortSubscriptionInfo:
    type: "object"
    properties:
      id:
        type: "string"
        example: "adcaac2d-26c0-4728-b2a9-4286bbd3e324"
      status:
        type: "string"
        example: "ACTIVE"
      created:
        type: "string"
        format: "date-time"
        example: "2019-07-02T01:00:00.000Z"
      modified:
        type: "string"
        format: "date-time"
        example: "2019-07-02T01:00:00.000Z"
      offer_id:
        type: "string"
        example: "6d5a1ef3-57fb-4739-abe7-fb1ecdac84af"
  ShortPersonInfo:
    type: "object"
    properties:
      id:
        type: "string"
        example: "942387299"
      business_id:
        type: "string"
        example: "12345678"
      salutation:
        type: "string"
        example: "Mr"
      title_before:
        type: "string"
        example: ""
      first_name:
        type: "string"
        example: "Alan"
      last_name:
        type: "string"
        example: "Turing"
      title_after:
        type: "string"
        example: ""
      phone:
        type: "string"
        example: "+42012341234"
      email:
        type: "string"
        example: "test@example.com"
      position:
        type: "string"
        example: "CEO"
      birth_number:
        type: "string"
        example: "1234567"
      id_number:
        type: "string"
        example: "P3546359"
      id_type:
        type: "string"
        example: "IDC"
      is_statutory:
        type: "boolean"
        example: true
      is_owner:
        type: "boolean"
        example: false
      status:
        type: "string"
        enum:
          - NEW
          - ACTIVE
          - INACTIVE
        example: "ACTIVE"
      active_since:
        type: "string"
        format: "date"
        example: "2020-07-11"
      active_until:
        type: "string"
        format: "date"
        example: ""
      invitation_url:
        type: "string"
        example: "https://mygp.cz/onboarding/invitation/xyz123abc456"
  ShortAccountInfo:
    type: "object"
    properties:
      id:
        type: "string"
        example: "GPEACC000000009999888"
      business_id:
        type: "string"
        example: "12345678"
      account_type:
        type: "string"
        example: "P"
      iban:
        type: "string"
        example: "CZ2720100000002609999888"
      currency:
        type: "string"
        example: "CZK"
      bank:
        type: "string"
        example: "FIOBCZPP"
      status:
        type: "string"
        enum:
          - NEW
          - ACTIVE
          - INACTIVE
        example: "ACTIVE"
      active_since:
        type: "string"
        format: "date"
        example: "2020-07-11"
      active_until:
        type: "string"
        format: "date"
        example: ""
  GetPersonsForCompanyResponse:
    type: object
    properties:
      count:
        type: "integer"
        format: "int64"
        example: 12
      next:
        type: "string"
        format: "url"
        example: "https://api.mygp.cz/v1/companies/NCC1701/persons?limit=10&offset=10"
        description: resource URL for the next batch of persons
      previous:
        type: "string"
        format: "url"
        example: null
        description: resource URL for the previous batch of persons
      results:
        type: "array"
        items:
          $ref: "#/definitions/ShortPersonInfo"
        example:
          - id: "6573467568"
            salutation: "Mr"
            title_before: ""
            first_name: "James"
            last_name: "Kirk"
            title_after: ""
            phone: "+42012341234"
            email: "test@example.com"
            position: "Captain"
            birth_number: "1234567"
            id_number: "P3546359"
            id_type: "IDC"
            is_statutory: true
            is_owner: false
            status: "ACTIVE"
            active_since: "2020-07-11"
            active_until: ""
            invitation_url: "https://mygp.cz/onboarding/invitation/xyz123abc456"
  GetPersonDetailsResponse:
    type: "object"
    properties:
      id:
        type: "string"
        example: "942387299"
      salutation:
        type: "string"
        example: "Mr"
      title_before:
        type: "string"
        example: "RtH"
      first_name:
        type: "string"
        example: "Alan"
      last_name:
        type: "string"
        example: "Turing"
      title_after:
        type: "string"
        example: "PhD"
      phone:
        type: "string"
        example: "+4287878399"
      email:
        type: "string"
        example: "mailbox@example.org"
      position:
        type: "string"
        example: "CEO"
      birth_number:
        type: "string"
        example: "10040067328"
      id_number:
        type: "string"
        example: "AB9992223"
      id_type:
        type: "string"
        example: "IDC"
      is_statutory:
        type: "boolean"
        example: true
      is_owner:
        type: "boolean"
        example: false
      active_since:
        type: "string"
        format: "date"
        example: "2014-10-07"
      active_until:
        type: "string"
        format: "date"
        example: "2019-08-19"
      status:
        type: "string"
        enum:
          - NEW
          - ACTIVE
          - INACTIVE
        example: "ACTIVE"
      updated:
        type: "string"
        format: "date-time"
        example: "2019-07-02T01:00:00.000Z"
  UserProfileInfo:
    type: "object"
    properties:
      business_id:
        type: "string"
        example: "7587485784"
      first_name:
        type: "string"
        example: "Joe"
      last_name:
        type: "string"
        example: "Grizzly"
      email:
        type: "string"
        example: "joe.grizzly@example.org"
  ConsentDecisionRepresentation:
    type: "object"
    required:
      - name
      - decision
    properties:
      name:
        type: "string"
        example: "general"
      decision_status:
        type: "string"
        enum:
          - GRANTED
          - DECLINED
        example: "GRANTED"
  ConsentStatusRepresentation:
    type: "object"
    required:
      - name
      - decision_status
      - status_from
    properties:
      name:
        type: "string"
        example: "general"
      decision_status:
        type: "string"
        enum:
          - GRANTED
          - DECLINED
        example: "GRANTED"
      status_from:
        type: "string"
        format: "date"
        example: "YYYY-MM-DD"
      valid_until:
        type: "string"
        format: "date"
        example: "YYYY-MM-DD"
  UpdateConsentsRequest:
    type: "object"
    required:
      - data
    properties:
      data:
        type: "array"
        items:
          $ref: "#/definitions/ConsentDecisionRepresentation"
          minItems: 1
  UpdateConsentsResponse:
    type: "object"
    required:
      - data
    properties:
      data:
        type: "array"
        items:
          $ref: "#/definitions/ConsentStatusRepresentation"
  ApiResponse:
    type: "object"
    properties:
      code:
        type: "integer"
        format: "int32"
      type:
        type: "string"
      message:
        type: "string"