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

export interface IReq_GetConnections extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_GetConnections
> {
  method: 'getConnections';
  request: {
    identity: data.IIdentity;
  };
  response: {
    connections: data.IProviderConnection[];
  };
}

export interface IReq_CreateConnection extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_CreateConnection
> {
  method: 'createConnection';
  request: {
    identity: data.IIdentity;
    name: string;
    providerType: data.TProviderType;
    baseUrl: string;
    token: string;
    groupFilter?: string;
  };
  response: {
    connection: data.IProviderConnection;
  };
}

export interface IReq_UpdateConnection extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_UpdateConnection
> {
  method: 'updateConnection';
  request: {
    identity: data.IIdentity;
    connectionId: string;
    name?: string;
    baseUrl?: string;
    token?: string;
    groupFilter?: string;
  };
  response: {
    connection: data.IProviderConnection;
  };
}

export interface IReq_TestConnection extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_TestConnection
> {
  method: 'testConnection';
  request: {
    identity: data.IIdentity;
    connectionId: string;
  };
  response: {
    ok: boolean;
    error?: string;
  };
}

export interface IReq_PauseConnection extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_PauseConnection
> {
  method: 'pauseConnection';
  request: {
    identity: data.IIdentity;
    connectionId: string;
    paused: boolean;
  };
  response: {
    connection: data.IProviderConnection;
  };
}

export interface IReq_DeleteConnection extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_DeleteConnection
> {
  method: 'deleteConnection';
  request: {
    identity: data.IIdentity;
    connectionId: string;
  };
  response: {
    ok: boolean;
  };
}
