import {BaseResponse, BaseRequest, BaseQuery} from '@/types/base';
import {Environment} from '../../Environment/List/types';
import {Application} from '../../Application/List/types';
import {DevelopmentLanguageTypeEnum} from '../../Application/List/types';
import {BuildTypeEnum} from '../../Environment/List/types';
import type {JsonNode} from '@/types/common';
import type {WorkflowDefinition} from '@/pages/Workflow/Definition/types';

// 部署配置模板
export interface DeployConfigTemplate {
    code: string;
    name: string;
    buildType: BuildTypeEnum;
    languageType: DevelopmentLanguageTypeEnum;
    buildVariablesSchema: JsonNode;
}

// 部署配置基础信息
export interface DeploymentConfig extends BaseResponse {
    environmentId: number;
    environment: Environment;
    applicationId: number;
    application: Application;
    buildType: BuildTypeEnum;
    languageType: DevelopmentLanguageTypeEnum;
    workflowDefinitionId: number;
    publishedWorkflowDefinition?: WorkflowDefinition;
    buildVariables: JsonNode;
    formVariablesSchema: JsonNode,
    lastBuildStatus: string,
    lastBuildStartTime: string,
    lastBuildEndTime: string,
    enabled: boolean;
}

// 创建部署配置请求参数
export interface CreateDeploymentConfigRequest extends BaseRequest {
    environmentId: number;
    applicationId: number;
    buildType: BuildTypeEnum;
    languageType: DevelopmentLanguageTypeEnum;
    workflowDefinitionId: number;
    buildVariables: JsonNode;
    formVariablesSchema?: JsonNode;
    enabled: boolean;
}

// 更新部署配置请求参数
export interface UpdateDeploymentConfigRequest extends CreateDeploymentConfigRequest {
    id: number;
}

// 分页查询参数
export interface DeploymentConfigQueryParams extends BaseQuery {
    environmentId?: number;
    applicationId?: number;
    workflowDefinitionId: number;
    enabled?: boolean;
} 