//    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/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/medicinal_product_indication_go_proto";

// Auto-generated from StructureDefinition for MedicinalProductIndication.
// MedicinalProductIndication.
// See http://hl7.org/fhir/StructureDefinition/MedicinalProductIndication
message MedicinalProductIndication {
  option (.google.fhir.proto.structure_definition_kind) = KIND_RESOURCE;
  option (.google.fhir.proto.fhir_structure_definition_url) =
      "http://hl7.org/fhir/StructureDefinition/MedicinalProductIndication";

  // 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:
  // MedicinalProductIndication.contained
  reserved 7;

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

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

  // The medication for which this is an indication
  repeated Reference subject = 10 [
    (.google.fhir.proto.valid_reference_type) = "MedicinalProduct",
    (.google.fhir.proto.valid_reference_type) = "Medication"
  ];

  // The disease, symptom or procedure that is the indication for treatment
  CodeableConcept disease_symptom_procedure = 11;

  // The status of the disease or symptom for which the indication applies
  CodeableConcept disease_status = 12;

  // Comorbidity (concurrent condition) or co-infection as part of the
  // indication
  repeated CodeableConcept comorbidity = 13;

  // The intended effect, aim or strategy to be achieved by the indication
  CodeableConcept intended_effect = 14;

  // Timing or duration information as part of the indication
  Quantity duration = 15;

  // Information about the use of the medicinal product in relation to other
  // therapies described as part of the indication
  message OtherTherapy {
    // 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;

    // The type of relationship between the medicinal product indication or
    // contraindication and another therapy
    CodeableConcept therapy_relationship_type = 4
        [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

    // Reference to a specific medication (active substance, medicinal product
    // or class of products) as part of an indication or contraindication
    message MedicationX {
      option (.google.fhir.proto.is_choice_type) = true;

      oneof choice {
        CodeableConcept codeable_concept = 1;
        Reference reference = 2 [
          (.google.fhir.proto.valid_reference_type) = "MedicinalProduct",
          (.google.fhir.proto.valid_reference_type) = "Medication",
          (.google.fhir.proto.valid_reference_type) = "Substance",
          (.google.fhir.proto.valid_reference_type) = "SubstanceSpecification"
        ];
      }
    }
    MedicationX medication = 5
        [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];
  }
  repeated OtherTherapy other_therapy = 16;

  // Describe the undesirable effects of the medicinal product
  repeated Reference undesirable_effect = 17
      [(.google.fhir.proto.valid_reference_type) =
           "MedicinalProductUndesirableEffect"];

  // The population group to which this applies
  repeated Population population = 18;
}
