package cn.novalon.gym.manage.groupcourse.domain;

import cn.novalon.gym.manage.sys.core.domain.BaseDomain;
import io.swagger.v3.oas.annotations.media.Schema;

import java.util.ArrayList;
import java.util.List;

public class GroupCourseType extends BaseDomain {

    //类型名称
    @Schema(description = "类型名称", example = "瑜伽入门")
    private String typeName;

    //基础难度（1-10）
    @Schema(description = "基础难度（1-10）", example = "2")
    private Integer baseDifficulty;

    //类型描述
    @Schema(description = "类型描述", example = "适合初学者的瑜伽课程")
    private String description;

    //分类（如：有氧、力量、柔韧等）
    @Schema(description = "分类", example = "柔韧与平衡类")
    private String category;

    //标签列表
    @Schema(description = "标签列表")
    private List<CourseLabel> labels = new ArrayList<>();

    /**
     * 计算综合难度系数
     * 
     * 当前实现仅返回基础难度，为后续扩展预留空间。
     * 未来可扩展的影响因素包括：
     * 1. 课程时长系数（时长越长难度越高）
     * 2. 教练难度调整系数（教练可根据实际情况微调）
     * 3. 会员等级适配系数（根据会员等级动态调整显示难度）
     * 4. 课程强度系数（高强度课程难度加成）
     * 
     * @return 综合难度系数（1-10）
     */
    @Schema(description = "综合难度系数（预留扩展字段）", example = "2")
    public Integer getCalculatedDifficulty() {
        // TODO: 预留扩展点 - 未来可在此处添加更多难度计算逻辑
        // 例如：return calculateDynamicDifficulty(baseDifficulty, additionalFactors...);
        return this.baseDifficulty != null ? this.baseDifficulty : 1;
    }

    /**
     * 获取难度等级描述
     * 将数字难度转换为友好的文字描述
     * 
     * @return 难度等级描述
     */
    @Schema(description = "难度等级描述", example = "初级")
    public String getDifficultyLevel() {
        if (baseDifficulty == null) {
            return "未知";
        }
        if (baseDifficulty <= 2) {
            return "初级";
        } else if (baseDifficulty <= 4) {
            return "中级";
        } else if (baseDifficulty <= 6) {
            return "中高级";
        } else if (baseDifficulty <= 8) {
            return "高级";
        } else {
            return "专家级";
        }
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public Integer getBaseDifficulty() {
        return baseDifficulty;
    }

    public void setBaseDifficulty(Integer baseDifficulty) {
        this.baseDifficulty = baseDifficulty;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public List<CourseLabel> getLabels() {
        return labels;
    }

    public void setLabels(List<CourseLabel> labels) {
        this.labels = labels;
    }
}