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

export interface IReq_GetPipelines extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_GetPipelines
> {
  method: 'getPipelines';
  request: {
    identity: data.IIdentity;
    connectionId: string;
    projectId?: string;
    viewMode?: 'current' | 'project' | 'group' | 'error';
    groupId?: string;
    status?: string;
    sortBy?: 'created' | 'duration' | 'status';
    timeRange?: '1h' | '6h' | '1d' | '3d' | '7d' | '30d';
    page?: number;
  };
  response: {
    pipelines: data.IPipeline[];
  };
}

export interface IReq_GetPipelineJobs extends plugins.typedrequestInterfaces.implementsTR<
  plugins.typedrequestInterfaces.ITypedRequest,
  IReq_GetPipelineJobs
> {
  method: 'getPipelineJobs';
  request: {
    identity: data.IIdentity;
    connectionId: string;
    projectId: string;
    pipelineId: string;
  };
  response: {
    jobs: data.IPipelineJob[];
  };
}

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

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