import React from 'react';
import {
    GithubOutlined,
    GitlabOutlined,
    CloudServerOutlined,
    CloudOutlined,
    DesktopOutlined,
    ApiOutlined,
} from '@ant-design/icons';
import {BuildTypeEnum, DeployTypeEnum} from './types';

interface TypeInfo {
    label: string;
    color: string;
    icon: React.ReactNode;
}

// 获取构建方式信息
export const getBuildTypeInfo = (type: BuildTypeEnum): TypeInfo => {
    switch (type) {
        case BuildTypeEnum.JENKINS:
            return {
                label: 'Jenkins构建',
                color: '#D24939',
                icon: <ApiOutlined/>,
            };
        case BuildTypeEnum.GITLAB_RUNNER:
            return {
                label: 'GitLab Runner构建',
                color: '#FC6D26',
                icon: <GitlabOutlined/>,
            };
        case BuildTypeEnum.GITHUB_ACTION:
            return {
                label: 'GitHub Action构建',
                color: '#2088FF',
                icon: <GithubOutlined/>,
            };
        default:
            return {
                label: type || '未知',
                color: '#666666',
                icon: <ApiOutlined/>,
            };
    }
};

// 获取部署方式信息
export const getDeployTypeInfo = (type: DeployTypeEnum): TypeInfo => {
    switch (type) {
        case DeployTypeEnum.K8S:
            return {
                label: 'Kubernetes集群部署',
                color: '#326CE5',
                icon: <CloudServerOutlined/>,
            };
        case DeployTypeEnum.DOCKER:
            return {
                label: 'Docker容器部署',
                color: '#2496ED',
                icon: <CloudOutlined/>,
            };
        case DeployTypeEnum.VM:
            return {
                label: '虚拟机部署',
                color: '#F7B93E',
                icon: <DesktopOutlined/>,
            };
        default:
            return {
                label: type || '未知',
                color: '#666666',
                icon: <CloudServerOutlined/>,
            };
    }
}; 