//    Copyright 2019 Google Inc.
//
//    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
//
//        https://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.

syntax = "proto3";

package google.fhir.r4.core;

import "google/protobuf/any.proto";
import "google/fhir/core/proto/annotations.proto";
import "google/fhir/r4/proto/core/codes.proto";
import "google/fhir/r4/proto/core/datatypes.proto";

option java_multiple_files = true;
option java_package = "com.google.fhir.r4.core";
option (.google.fhir.proto.fhir_version) = R4;
option go_package = "github.com/google/fhir/go/google/fhir/r4/proto/core/resources/terminology_capabilities_go_proto";

// Auto-generated from StructureDefinition for TerminologyCapabilities.
// A statement of system capabilities.
// See http://hl7.org/fhir/StructureDefinition/TerminologyCapabilities
message TerminologyCapabilities {
  option (.google.fhir.proto.structure_definition_kind) = KIND_RESOURCE;
  option (.google.fhir.proto.fhir_structure_definition_url) =
      "http://hl7.org/fhir/StructureDefinition/TerminologyCapabilities";
  option (.google.fhir.proto.fhir_path_message_constraint) =
      "(description.count() + software.count() + implementation.count()) > 0";
  option (.google.fhir.proto.fhir_path_message_constraint) =
      "(kind != 'instance') or implementation.exists()";
  option (.google.fhir.proto.fhir_path_message_constraint) =
      "(kind != 'capability') or (implementation.exists().not() and software.exists())";
  option (.google.fhir.proto.fhir_path_message_constraint) =
      "(kind!='requirements') or (implementation.exists().not() and software.exists().not())";
  option (.google.fhir.proto.fhir_path_message_warning_constraint) =
      "name.matches('[A-Z]([A-Za-z0-9_]){0,254}')";

  // Logical id of this artifact
  Id id = 1;

  // Metadata about the resource
  Meta meta = 2;

  // A set of rules under which this content was created
  Uri implicit_rules = 3;

  // Language of the resource content
  Code language = 4;

  // Text summary of the resource, for human interpretation
  Narrative text = 5;

  // Contained, inline Resources
  repeated protobuf.Any contained = 6;

  // Field 7 reserved for strongly-typed ContainedResource for id:
  // TerminologyCapabilities.contained
  reserved 7;

  // Additional content defined by implementations
  repeated Extension extension = 8;

  // Extensions that cannot be ignored
  repeated Extension modifier_extension = 9;

  // Canonical identifier for this terminology capabilities, represented as a
  // URI (globally unique)
  Uri url = 10;

  // Business version of the terminology capabilities
  String version = 11;

  // Name for this terminology capabilities (computer friendly)
  String name = 12;

  // Name for this terminology capabilities (human friendly)
  String title = 13;

  // draft | active | retired | unknown
  message StatusCode {
    option (.google.fhir.proto.structure_definition_kind) = KIND_PRIMITIVE_TYPE;
    option (.google.fhir.proto.fhir_valueset_url) =
        "http://hl7.org/fhir/ValueSet/publication-status";
    option (.google.fhir.proto.fhir_profile_base) =
        "http://hl7.org/fhir/StructureDefinition/code";

    PublicationStatusCode.Value value = 1;

    String id = 2;

    repeated Extension extension = 3;
  }
  StatusCode status = 14
      [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

  // For testing purposes, not real usage
  Boolean experimental = 15;

  // Date last changed
  DateTime date = 16
      [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

  // Name of the publisher (organization or individual)
  String publisher = 17;

  // Contact details for the publisher
  repeated ContactDetail contact = 18;

  // Natural language description of the terminology capabilities
  Markdown description = 19;

  // The context that the content is intended to support
  repeated UsageContext use_context = 20;

  // Intended jurisdiction for terminology capabilities (if applicable)
  repeated CodeableConcept jurisdiction = 21;

  // Why this terminology capabilities is defined
  Markdown purpose = 22;

  // Use and/or publishing restrictions
  Markdown copyright = 23;

  // instance | capability | requirements
  message KindCode {
    option (.google.fhir.proto.structure_definition_kind) = KIND_PRIMITIVE_TYPE;
    option (.google.fhir.proto.fhir_valueset_url) =
        "http://hl7.org/fhir/ValueSet/capability-statement-kind";
    option (.google.fhir.proto.fhir_profile_base) =
        "http://hl7.org/fhir/StructureDefinition/code";

    CapabilityStatementKindCode.Value value = 1;

    String id = 2;

    repeated Extension extension = 3;
  }
  KindCode kind = 24
      [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

  // Software that is covered by this terminology capability statement
  message Software {
    // Unique id for inter-element referencing
    String id = 1;

    // Additional content defined by implementations
    repeated Extension extension = 2;

    // Extensions that cannot be ignored even if unrecognized
    repeated Extension modifier_extension = 3;

    // A name the software is known by
    String name = 4
        [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

    // Version covered by this statement
    String version = 5;
  }
  Software software = 25;

  // If this describes a specific instance
  message Implementation {
    // Unique id for inter-element referencing
    String id = 1;

    // Additional content defined by implementations
    repeated Extension extension = 2;

    // Extensions that cannot be ignored even if unrecognized
    repeated Extension modifier_extension = 3;

    // Describes this specific instance
    String description = 4
        [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

    // Base URL for the implementation
    Url url = 5;
  }
  Implementation implementation = 26;

  // Whether lockedDate is supported
  Boolean locked_date = 27;

  // A code system supported by the server
  message CodeSystem {
    option (.google.fhir.proto.fhir_path_message_constraint) =
        "version.count() > 1 implies version.all(code.exists())";

    // Unique id for inter-element referencing
    String id = 1;

    // Additional content defined by implementations
    repeated Extension extension = 2;

    // Extensions that cannot be ignored even if unrecognized
    repeated Extension modifier_extension = 3;

    // URI for the Code System
    Canonical uri = 4;

    // Version of Code System supported
    message Version {
      // Unique id for inter-element referencing
      String id = 1;

      // Additional content defined by implementations
      repeated Extension extension = 2;

      // Extensions that cannot be ignored even if unrecognized
      repeated Extension modifier_extension = 3;

      // Version identifier for this version
      String code = 4;

      // If this is the default version for this code system
      Boolean is_default = 5;

      // If compositional grammar is supported
      Boolean compositional = 6;

      // Language Displays supported
      repeated Code language = 7;

      // Filter Properties supported
      message Filter {
        // Unique id for inter-element referencing
        String id = 1;

        // Additional content defined by implementations
        repeated Extension extension = 2;

        // Extensions that cannot be ignored even if unrecognized
        repeated Extension modifier_extension = 3;

        // Code of the property supported
        Code code = 4
            [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

        // Operations supported for the property
        repeated Code op = 5
            [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];
      }
      repeated Filter filter = 8;

      // Properties supported for $lookup
      repeated Code property = 9;
    }
    repeated Version version = 5;

    // Whether subsumption is supported
    Boolean subsumption = 6;
  }
  repeated CodeSystem code_system = 28;

  // Information about the [ValueSet/$expand](valueset-operation-expand.html)
  // operation
  message Expansion {
    // Unique id for inter-element referencing
    String id = 1;

    // Additional content defined by implementations
    repeated Extension extension = 2;

    // Extensions that cannot be ignored even if unrecognized
    repeated Extension modifier_extension = 3;

    // Whether the server can return nested value sets
    Boolean hierarchical = 4;

    // Whether the server supports paging on expansion
    Boolean paging = 5;

    // Allow request for incomplete expansions?
    Boolean incomplete = 6;

    // Supported expansion parameter
    message Parameter {
      // Unique id for inter-element referencing
      String id = 1;

      // Additional content defined by implementations
      repeated Extension extension = 2;

      // Extensions that cannot be ignored even if unrecognized
      repeated Extension modifier_extension = 3;

      // Expansion Parameter name
      Code name = 4
          [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

      // Description of support for parameter
      String documentation = 5;
    }
    repeated Parameter parameter = 7;

    // Documentation about text searching works
    Markdown text_filter = 8;
  }
  Expansion expansion = 29;

  // explicit | all
  message CodeSearchCode {
    option (.google.fhir.proto.structure_definition_kind) = KIND_PRIMITIVE_TYPE;
    option (.google.fhir.proto.fhir_valueset_url) =
        "http://hl7.org/fhir/ValueSet/code-search-support";
    option (.google.fhir.proto.fhir_profile_base) =
        "http://hl7.org/fhir/StructureDefinition/code";

    CodeSearchSupportCode.Value value = 1;

    String id = 2;

    repeated Extension extension = 3;
  }
  CodeSearchCode code_search = 30;

  // Information about the
  // [ValueSet/$validate-code](valueset-operation-validate-code.html) operation
  message ValidateCode {
    // Unique id for inter-element referencing
    String id = 1;

    // Additional content defined by implementations
    repeated Extension extension = 2;

    // Extensions that cannot be ignored even if unrecognized
    repeated Extension modifier_extension = 3;

    // Whether translations are validated
    Boolean translations = 4
        [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];
  }
  ValidateCode validate_code = 31;

  // Information about the
  // [ConceptMap/$translate](conceptmap-operation-translate.html) operation
  message Translation {
    // Unique id for inter-element referencing
    String id = 1;

    // Additional content defined by implementations
    repeated Extension extension = 2;

    // Extensions that cannot be ignored even if unrecognized
    repeated Extension modifier_extension = 3;

    // Whether the client must identify the map
    Boolean needs_map = 4
        [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];
  }
  Translation translation = 32;

  // Information about the
  // [ConceptMap/$closure](conceptmap-operation-closure.html) operation
  message Closure {
    // Unique id for inter-element referencing
    String id = 1;

    // Additional content defined by implementations
    repeated Extension extension = 2;

    // Extensions that cannot be ignored even if unrecognized
    repeated Extension modifier_extension = 3;

    // If cross-system closure is supported
    Boolean translation = 4;
  }
  Closure closure = 33;
}
