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

// Auto-generated from StructureDefinition for MedicinalProductIngredient.
// An ingredient of a manufactured item or pharmaceutical product.
// See http://hl7.org/fhir/StructureDefinition/MedicinalProductIngredient
message MedicinalProductIngredient {
  option (.google.fhir.proto.structure_definition_kind) = KIND_RESOURCE;
  option (.google.fhir.proto.fhir_structure_definition_url) =
      "http://hl7.org/fhir/StructureDefinition/MedicinalProductIngredient";

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

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

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

  // Identifier for the ingredient
  Identifier identifier = 10;

  // Ingredient role e.g. Active ingredient, excipient
  CodeableConcept role = 11
      [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

  // If the ingredient is a known or suspected allergen
  Boolean allergenic_indicator = 12;

  // Manufacturer of this Ingredient
  repeated Reference manufacturer = 13
      [(.google.fhir.proto.valid_reference_type) = "Organization"];

  // A specified substance that comprises this ingredient
  message SpecifiedSubstance {
    // 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 specified substance
    CodeableConcept code = 4
        [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

    // The group of specified substance, e.g. group 1 to 4
    CodeableConcept group = 5
        [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

    // Confidentiality level of the specified substance as the ingredient
    CodeableConcept confidentiality = 6;

    // Quantity of the substance or specified substance present in the
    // manufactured item or pharmaceutical product
    message Strength {
      // 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 quantity of substance in the unit of presentation, or in the volume
      // (or mass) of the single pharmaceutical product or manufactured item
      Ratio presentation = 4
          [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

      // A lower limit for the quantity of substance in the unit of
      // presentation. For use when there is a range of strengths, this is the
      // lower limit, with the presentation attribute becoming the upper limit
      Ratio presentation_low_limit = 5;

      // The strength per unitary volume (or mass)
      Ratio concentration = 6;

      // A lower limit for the strength per unitary volume (or mass), for when
      // there is a range. The concentration attribute then becomes the upper
      // limit
      Ratio concentration_low_limit = 7;

      // For when strength is measured at a particular point or distance
      String measurement_point = 8;

      // The country or countries for which the strength range applies
      repeated CodeableConcept country = 9;

      // Strength expressed in terms of a reference substance
      message ReferenceStrength {
        // 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;

        // Relevant reference substance
        CodeableConcept substance = 4;

        // Strength expressed in terms of a reference substance
        Ratio strength = 5
            [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

        // Strength expressed in terms of a reference substance
        Ratio strength_low_limit = 6;

        // For when strength is measured at a particular point or distance
        String measurement_point = 7;

        // The country or countries for which the strength range applies
        repeated CodeableConcept country = 8;
      }
      repeated ReferenceStrength reference_strength = 10;
    }
    repeated Strength strength = 7;
  }
  repeated SpecifiedSubstance specified_substance = 14;

  // The ingredient substance
  message Substance {
    // 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 ingredient substance
    CodeableConcept code = 4
        [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

    // Quantity of the substance or specified substance present in the
    // manufactured item or pharmaceutical product
    repeated SpecifiedSubstance.Strength strength = 5;
  }
  Substance substance = 15;
}
