/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you 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
 *
 *   http://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";

option java_multiple_files = true;
package org.apache.custos.core.tenant.profile.api;


message Tenant {
  int64 tenant_id = 1;
  string client_name = 2;
  string requester_email = 4;
  string admin_first_name = 5;
  string admin_last_name = 6;
  string admin_email = 7;
  string admin_username = 8;
  string admin_password = 9;
  TenantStatus tenant_status = 10;
  repeated string contacts = 11;
  repeated string redirect_uris = 12;
  string client_uri = 13;
  string scope = 14;
  string domain = 15;
  string comment = 16;
  string logo_uri = 17;
  int64 parent_tenant_id = 18;
  string application_type = 19;
  string token_endpoint_auth_method = 20;
  string jwks_uri = 21;
  string example_extension_parameter = 22;
  string tos_uri = 23;
  string policy_uri = 24;
  map<string, string> jwks = 25;
  string software_id = 26;
  string software_version = 27;
  int64 refesh_token_lifetime = 28;
  string client_id = 29;
  string parent_client_id = 30;
}

enum TenantStatus {
  UNKNOWN = 0;
  REQUESTED = 1;
  APPROVED = 2;
  DENIED = 3;
  CANCELLED = 4;
  ACTIVE = 5;
  DEACTIVATED = 6;
}

enum TenantType {
  UNSPECIFIED = 0;
  ADMIN = 1;
}

message TenantAttributeUpdateMetadata {
  string updated_attribute = 1;
  string updated_attributeValue = 2;
  string updated_by = 3;
  string updated_at = 4;
}

message TenantStatusUpdateMetadata {
  TenantStatus updated_status = 1;
  string updated_by = 2;
  string updated_at = 3;
}


message AddTenantResponse {
  int64 tenant_id = 1;
}


message UpdateTenantResponse {
  Tenant tenant = 1;

}

message GetTenantRequest {
  int64 tenant_id = 1;
}

message GetTenantResponse {
  Tenant tenant = 1;
}


message GetAllTenantsResponse {
  repeated Tenant tenant = 1;
  int32 total_num_of_tenants =2;
}

message IsTenantExistRequest {
  int64 tenant_id = 1;
}

message IsTenantExistResponse {
  bool is_exist = 1;
}

message GetAllTenantsForUserRequest {
  string requester_email = 1;
}

message GetAllTenantsForUserResponse {
  repeated Tenant tenant = 1;
}

message UpdateStatusRequest {
  string client_id = 1;
  TenantStatus status = 2;
  string updated_by = 3;
  int64 tenant_id = 4;
  bool super_tenant = 5;
  string access_token = 6;
}

message UpdateStatusResponse {
  int64 tenant_id = 1;
  TenantStatus status = 2;
}

message GetAuditTrailRequest {
  int64 tenant_id = 1;
}

message GetStatusUpdateAuditTrailResponse {
  repeated TenantStatusUpdateMetadata metadata = 1;
}

message GetAttributeUpdateAuditTrailResponse {
  repeated TenantAttributeUpdateMetadata metadata = 2;
}

message GetTenantsRequest {
  int32 offset = 1;
  int32 limit = 2;
  int64 parent_id = 3;
  TenantStatus status = 4;
  string requester_email = 5;
  string parent_client_id = 6;
  TenantType type= 7;
}
