/*
 * 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.credential.store.api;


enum Type {
  CUSTOS = 0;
  IAM = 1;
  CILOGON = 2;
  INDIVIDUAL = 3;
  AGENT_CLIENT = 4;
  AGENT = 5;
}

message CredentialMetadata {
  int64 owner_id = 1;
  string id = 2;
  string secret = 3;
  int64 client_secret_expired_at = 4;
  int64 client_id_issued_at = 5;
  Type type = 6;
  bool super_tenant = 7;
  bool super_admin = 8;
  string internal_sec = 11;
}

message GetCredentialRequest {
  int64 ownerId = 1;
  string id = 2;
  Type type = 3;
}

message GetAllCredentialsRequest {
  int64 ownerId = 1;
}

message GetAllCredentialsResponse {
  repeated CredentialMetadata secret_list = 1;
  string requester_user_email = 2;
  string requester_username = 3;
}

message OperationStatus {
  bool state = 1;
}

message DeleteCredentialRequest {
  int64 owner_id = 1;
  Type type = 2;
}

message GetOperationsMetadataRequest {
  int64 trace_id = 1;
}

message OperationMetadata {
  string event = 1;
  string status = 2;
  string time_stamp = 3;
  string performed_by = 4;
}
message GetOperationsMetadataResponse {
  repeated OperationMetadata metadata = 1;
}

message GetNewCustosCredentialRequest {
  int64 owner_id = 1;
  string performed_by = 2;
  bool is_super_tenant = 3;
}

message GetNewCustosCredentialResponse {
  string client_id = 1;
  string client_secret = 2;
}

message TokenRequest {
  string token = 1;
  string parent_client_id = 2;
}

message GetOwnerIdResponse {
  int64 owner_id = 2;
}

message Credentials {
  string iam_client_id = 1;
  string iam_client_secret = 2;
  string ci_logon_client_id = 3;
  string ci_logon_client_secret = 4;
  string custos_client_id = 5;
  string custos_client_secret = 6;
  double custos_client_id_issued_at = 7;
  double custos_client_secret_expired_at = 8;
}
