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

// Auto-generated from StructureDefinition for MedicinalProductPackaged.
// A medicinal product in a container or package.
// See http://hl7.org/fhir/StructureDefinition/MedicinalProductPackaged
message MedicinalProductPackaged {
  option (.google.fhir.proto.structure_definition_kind) = KIND_RESOURCE;
  option (.google.fhir.proto.fhir_structure_definition_url) =
      "http://hl7.org/fhir/StructureDefinition/MedicinalProductPackaged";

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

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

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

  // Unique identifier
  repeated Identifier identifier = 10;

  // The product with this is a pack for
  repeated Reference subject = 11
      [(.google.fhir.proto.valid_reference_type) = "MedicinalProduct"];

  // Textual description
  String description = 12;

  // The legal status of supply of the medicinal product as classified by the
  // regulator
  CodeableConcept legal_status_of_supply = 13;

  // Marketing information
  repeated MarketingStatus marketing_status = 14;

  // Manufacturer of this Package Item
  Reference marketing_authorization = 15
      [(.google.fhir.proto.valid_reference_type) =
           "MedicinalProductAuthorization"];

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

  // Batch numbering
  message BatchIdentifier {
    // 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 number appearing on the outer packaging of a specific batch
    Identifier outer_packaging = 4
        [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

    // A number appearing on the immediate packaging (and not the outer
    // packaging)
    Identifier immediate_packaging = 5;
  }
  repeated BatchIdentifier batch_identifier = 17;

  // A packaging item, as a contained for medicine, possibly with other
  // packaging items within
  message PackageItem {
    // 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;

    // Including possibly Data Carrier Identifier
    repeated Identifier identifier = 4;

    // The physical type of the container of the medicine
    CodeableConcept type = 5
        [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

    // The quantity of this package in the medicinal product, at the current
    // level of packaging. The outermost is always 1
    Quantity quantity = 6
        [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

    // Material type of the package item
    repeated CodeableConcept material = 7;

    // A possible alternate material for the packaging
    repeated CodeableConcept alternate_material = 8;

    // A device accompanying a medicinal product
    repeated Reference device = 9
        [(.google.fhir.proto.valid_reference_type) = "DeviceDefinition"];

    // The manufactured item as contained in the packaged medicinal product
    repeated Reference manufactured_item = 10
        [(.google.fhir.proto.valid_reference_type) =
             "MedicinalProductManufactured"];

    // Allows containers within containers
    repeated PackageItem package_item = 11;

    // Dimensions, color etc.
    ProdCharacteristic physical_characteristics = 12;

    // Other codeable characteristics
    repeated CodeableConcept other_characteristics = 13;

    // Shelf Life and storage information
    repeated ProductShelfLife shelf_life_storage = 14;

    // Manufacturer of this Package Item
    repeated Reference manufacturer = 15
        [(.google.fhir.proto.valid_reference_type) = "Organization"];
  }
  repeated PackageItem package_item = 18
      [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];
}
