syntax = "proto2";

import "development/vndk/tools/header-checker/proto/abi_dump.proto";

package abi_diff;

message RecordFieldDeclDiff {
  optional abi_dump.RecordFieldDecl old = 1;
  optional abi_dump.RecordFieldDecl new = 2;
  optional uint32 index = 3;
}

message EnumFieldDeclDiff {
  optional abi_dump.EnumFieldDecl old = 1;
  optional abi_dump.EnumFieldDecl new = 2;
  optional uint32 index = 3;
}

message CXXBaseSpecifierDiff {
  optional abi_dump.CXXBaseSpecifier old = 1;
  optional abi_dump.CXXBaseSpecifier new = 2;
  optional uint32 index = 3;
}

message CXXVTableDiff {
  optional abi_dump.VTableComponent old = 1;
  optional abi_dump.VTableComponent new = 2;
  optional uint32 index = 3;
}

message BasicNamedAndTypedDeclDiff {
  optional abi_dump.BasicNamedAndTypedDecl old = 1;
  optional abi_dump.BasicNamedAndTypedDecl new = 2;
}

message RecordDeclDiff {
  repeated RecordFieldDeclDiff field_diffs = 1;
  repeated CXXBaseSpecifierDiff base_diffs = 2;
  repeated CXXVTableDiff vtable_diffs = 3;
  optional BasicNamedAndTypedDeclDiff type_diff = 4;
  optional string name = 5;
}

message EnumDeclDiff {
  repeated EnumFieldDeclDiff field_diffs = 1;
  optional BasicNamedAndTypedDeclDiff type_diff = 2;
  optional string name = 3;
}

message ReturnTypeDiff {
  optional abi_dump.BasicNamedAndTypedDecl old = 1;
  optional abi_dump.BasicNamedAndTypedDecl new = 2;
}

message ParamDeclDiff {
  optional abi_dump.ParamDecl old = 1;
  optional abi_dump.ParamDecl new = 2;
  optional uint32 index = 3;
}

message FunctionDeclDiff {
  optional ReturnTypeDiff return_type_diffs = 1;
  repeated ParamDeclDiff param_diffs = 2;
  optional string name = 3;
}

message GlobalVarDeclDiff {
  optional BasicNamedAndTypedDeclDiff type_diff = 1;
}

enum CompatibilityStatus {
  COMPATIBLE = 0;
  EXTENSION = 1;
  INCOMPATIBLE = 4;
}

message TranslationUnitDiff {
  // Library Name
  optional string lib_name = 1;
  optional string arch = 2;
  // Differing Elements.
  repeated RecordDeclDiff records_diff = 3;
  repeated EnumDeclDiff enums_diff = 4;
  repeated FunctionDeclDiff functions_diff = 5;
  repeated GlobalVarDeclDiff global_vars_diff = 6;
  // Removed Elements.
  repeated abi_dump.RecordDecl records_removed = 7;
  repeated abi_dump.FunctionDecl functions_removed = 8;
  repeated abi_dump.EnumDecl enums_removed = 9;
  repeated abi_dump.GlobalVarDecl global_vars_removed = 10;
  // Added Elements.
  repeated abi_dump.RecordDecl records_added = 11;
  repeated abi_dump.FunctionDecl functions_added = 12;
  repeated abi_dump.EnumDecl enums_added = 13;
  repeated abi_dump.GlobalVarDecl global_vars_added = 14;
  // Compatiblity Status
  optional CompatibilityStatus compatibility_status = 15;
}

// Not merged with TranslationUnitDiff to allow future extensions.
message ConciseDiffReportInformation {
  optional string lib_name = 1;
  optional string arch = 2;
  optional string diff_report_path = 3;
  optional CompatibilityStatus compatibility_status = 4;
}

message MergedTranslationUnitDiff {
  repeated ConciseDiffReportInformation diff_reports = 1;
}