package cn.reghao.devops.mgr.util;

import cn.reghao.devops.mgr.admin.model.constant.RoleType;
import cn.reghao.devops.mgr.admin.service.UserContext;
import cn.reghao.devops.mgr.app.model.constant.AppType;
import cn.reghao.devops.mgr.builder.model.constant.EnvType;

/**
 * @author reghao
 * @date 2023-12-01 11:29:21
 */
public class DefaultSetting {
    public static String getDefaultEnv() {
        /*Set<String> roles = UserContext.getUserRoles();
        if (roles.contains(RoleType.ROLE_DEVOPS.name())) {
            return EnvType.test.name();
        } else if (roles.contains(RoleType.ROLE_BACKEND.name())
                || roles.contains(RoleType.ROLE_FRONTEND.name())) {
            return EnvType.test.name();
        }*/
        return EnvType.test.name();
    }

    public static String getDefaultAppType() {
        String defaultAppType = AppType.dotnet.getName();
        String role = UserContext.getUserRole();
        if (role.equals(RoleType.ROLE_JAVA.name())) {
            defaultAppType = AppType.java.getName();
        } else if (role.equals(RoleType.ROLE_DOTNET.name())) {
            defaultAppType = AppType.dotnet.getName();
        } else if (role.equals(RoleType.ROLE_NPM.name())) {
            defaultAppType = AppType.npm.getName();
        }

        return defaultAppType;
    }
}
