//    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.fhirproto;

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.google";
option (.google.fhir.proto.fhir_version) = R4;

// Auto-generated from StructureDefinition for ValidationOutcome.
// Information about the success/failure of an action.
// See
// https://g.co/fhir/StructureDefinition/StructureDefinition/ValidationOutcome
message ValidationOutcome {
  option (.google.fhir.proto.structure_definition_kind) = KIND_RESOURCE;
  option (.google.fhir.proto.fhir_profile_base) =
      "http://hl7.org/fhir/StructureDefinition/OperationOutcome";
  option (.google.fhir.proto.fhir_structure_definition_url) =
      "https://g.co/fhir/StructureDefinition/StructureDefinition/ValidationOutcome";

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

  // Metadata about the resource
  core.Meta meta = 2;

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

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

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

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

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

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

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

  // A single issue associated with the action
  message Issue {
    // Unique id for inter-element referencing
    core.String id = 1;

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

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

    // fatal | error | warning | information
    message SeverityCode {
      option (.google.fhir.proto.structure_definition_kind) =
          KIND_PRIMITIVE_TYPE;
      option (.google.fhir.proto.fhir_valueset_url) =
          "http://hl7.org/fhir/ValueSet/issue-severity";
      option (.google.fhir.proto.fhir_profile_base) =
          "http://hl7.org/fhir/StructureDefinition/code";

      core.IssueSeverityCode.Value value = 1;

      core.String id = 2;

      repeated core.Extension extension = 3;
    }
    SeverityCode severity = 4
        [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

    // Error or warning code
    message CodeType {
      option (.google.fhir.proto.structure_definition_kind) =
          KIND_PRIMITIVE_TYPE;
      option (.google.fhir.proto.fhir_valueset_url) =
          "http://hl7.org/fhir/ValueSet/issue-type";
      option (.google.fhir.proto.fhir_profile_base) =
          "http://hl7.org/fhir/StructureDefinition/code";

      core.IssueTypeCode.Value value = 1;

      core.String id = 2;

      repeated core.Extension extension = 3;
    }
    CodeType code = 5
        [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

    // Additional details about the error
    core.CodeableConcept details = 6;

    // Additional diagnostic information about the issue
    core.String diagnostics = 7;

    // Deprecated: Path of element(s) related to issue
    repeated core.String location = 8;

    // FHIRPath of element(s) related to issue
    repeated core.String expression = 9;
  }
  repeated Issue issue = 10
      [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

  // The FHIR resource this Validation is for.
  core.Reference subject = 11
      [(.google.fhir.proto.fhir_inlined_extension_url) =
           "https://g.co/fhir/medicalrecords/OperationOutcomeSubject"];
}
