/*
Copyright 2022 Google LLC

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 sapagent.protos.sapapp;

option go_package = "github.com/GoogleCloudPlatform/sapagent/protos/sapapp";

enum InstanceType {
  INSTANCE_TYPE_UNDEFINED = 0;
  HANA = 1;
  NETWEAVER = 2;
}

enum InstanceSite {
  INSTANCE_SITE_UNDEFINED = 0;
  HANA_PRIMARY = 1;
  HANA_SECONDARY = 2;
  HANA_STANDALONE = 3;
  HANA_DR = 4;
}

enum InstanceKind {
  INSTANCE_KIND_UNDEFINED = 0;
  APP = 1;
  CS = 2;
  ERS = 3;
}

message SAPInstance {
  string sapsid = 1;           // HDB
  string instance_number = 2;  // 00
  string service_name = 3;
  InstanceType type = 4;  // HANA, NetWeaver
  InstanceSite site = 5;  // PRIMARY, SECONDARY
  repeated string hana_ha_members =
      6;  // List of HANA instance names that form a HANA HA configuration.
  string sapcontrol_path = 7;  // /usr/sap/HDB/HDB00/exe/sapcontrol
  string user = 8;             // hdbadm
  string instance_id = 9;      // HDB00 - unique identifier for SAP Instance.
  string netweaver_http_port = 10;
  string hana_db_user = 11;
  string hana_db_password = 12;
  string ld_library_path = 13;  // The Instance's LD_LIBRARY_PATH.
  string profile_path = 14;     // The instance's profile path.
  string netweaver_health_check_url = 15;
  InstanceKind kind = 16;        // APP, CS, ERS
  string hdbuserstore_key = 17;  // hdbuserstore key for database
  HANAReplicaSite hana_replication_tree =
      18;  // Nested instances for HANA replication. This value always contains
           // the primary instance for the HANA replication configuration.
}

message SAPInstances {
  repeated SAPInstance instances = 1;
  bool linux_cluster_member = 2;
}

message HANAReplicaSite {
  string name = 1;
  repeated HANAReplicaSite targets = 2;
}
