import * as plugins from '../plugins.ts';
import * as data from '../data/index.ts';

export interface IReq_GetAllSecrets extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_GetAllSecrets
> {
  method: 'getAllSecrets';
  request: {
    identity: data.IIdentity;
    connectionId: string;
    scope: 'project' | 'group';
  };
  response: {
    secrets: data.ISecret[];
  };
}

export interface IReq_GetSecrets extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_GetSecrets
> {
  method: 'getSecrets';
  request: {
    identity: data.IIdentity;
    connectionId: string;
    scope: 'project' | 'group';
    scopeId: string;
  };
  response: {
    secrets: data.ISecret[];
  };
}

export interface IReq_CreateSecret extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_CreateSecret
> {
  method: 'createSecret';
  request: {
    identity: data.IIdentity;
    connectionId: string;
    scope: 'project' | 'group';
    scopeId: string;
    key: string;
    value: string;
    protected?: boolean;
    masked?: boolean;
    environment?: string;
  };
  response: {
    secret: data.ISecret;
  };
}

export interface IReq_UpdateSecret extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_UpdateSecret
> {
  method: 'updateSecret';
  request: {
    identity: data.IIdentity;
    connectionId: string;
    scope: 'project' | 'group';
    scopeId: string;
    key: string;
    value: string;
    protected?: boolean;
    masked?: boolean;
    environment?: string;
  };
  response: {
    secret: data.ISecret;
  };
}

export interface IReq_DeleteSecret extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_DeleteSecret
> {
  method: 'deleteSecret';
  request: {
    identity: data.IIdentity;
    connectionId: string;
    scope: 'project' | 'group';
    scopeId: string;
    key: string;
  };
  response: {
    ok: boolean;
  };
}
