# Copyright 2021 - 2025 PeopleWare n.v.
#
# Licensed under the Apache License, Version 2.0 (the “License”);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an “AS IS” BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

type: object
examples:
  - structureVersion: 2
    discriminator: my-service/some-resource
    href: /my-service/v6/some-resource/564845?at=2021-01-19T17:14:18.482558Z
description: >-
  The resource's search document with the most up-to-date information, i.e., up-to-date up until, but not including,
  `x-date`.


  This is a contract between this service and clients of the search service. Specific properties are added for different
  `discriminators`. When returned by the search service, the property `href` is added. This is the canonical URI of the
  found resource, including an `at` query parameter, that refers to the precise version of the found resource that was
  indexed.
properties:
  structureVersion:
    examples:
      - 2
    description: Version of the data structure of this resource type
    minimum: 1
    const: 2
  discriminator:
    type: string
    examples:
      - my-service/some-resource
    description: >-
      Type of the indexed resource.


      This enables users to search only on particular resource type. The type is qualified with the service name, to
      avoid name clashes (slash-separated).
    minLength: 1
    pattern: ^([-a-z0-9]+)\/([-a-z0-9/]+)$
  href:
    type: string
    examples:
      - /my-service/v1/y/abc?at=2020-01-23T15:22:39.254888Z
    description: >-
      Canonical URI where the found resource's information is located, at the version that was indexed (`at` parameter
      _must_ be included).


      Users need to be directed to the version returned by the search index, and not an earlier or more recent version.
      The search engine updates, eventually, after a few seconds. If a more recent version is available in the meantime,
      the user interface makes it possible for the user to navigate to that version.


      A _canonical URI_ is the URI where are resource can be interacted with, without the scheme and authority (see [RFC
      3986 Uniform Resource Identifier (URI): Generic Syntax; 3. Syntax
      Components](https://www.rfc-editor.org/rfc/rfc3986#section-3)), and without the build number. By convention, the
      canonical URI’s first segment is the name of the service in which the URI resides, followed by the relative URI of
      the resource in the API of that service.


      The URI has an `at` qyuery parameter, expressing the knowledge time for which the service should return the
      resource. The value must be a moment in time, expressed as ISO-8601 in UTC ('Z'), to ms precision or more precise
      (should be μs precision).
    format: uri-reference
    minLength: 1
required:
  - structureVersion
  - discriminator
  - href
additionalProperties: true
