package com.ruoyi.web.modules.industryservice.support;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.ruoyi.web.modules.industryservice.domain.vo.BreedingIndustryAgeBandVo;
import com.ruoyi.web.modules.industryservice.domain.vo.BreedingIndustryMonthlyTrendPointVo;
import com.ruoyi.web.modules.screen.domain.vo.HomeScreenAgeBandVo;
import com.ruoyi.web.modules.screen.domain.vo.HomeScreenInventoryMonthVo;

/**
 * 养殖产业看板与填报表 / 大屏口径之间的 VO 转换。
 */
public final class BreedingIndustryDashboardSupport
{
    private BreedingIndustryDashboardSupport()
    {
    }

    public static List<BreedingIndustryMonthlyTrendPointVo> toMonthlyTrend(List<HomeScreenInventoryMonthVo> from)
    {
        if (from == null || from.isEmpty())
        {
            return Collections.emptyList();
        }
        List<BreedingIndustryMonthlyTrendPointVo> list = new ArrayList<>(from.size());
        for (HomeScreenInventoryMonthVo src : from)
        {
            BreedingIndustryMonthlyTrendPointVo point = new BreedingIndustryMonthlyTrendPointVo();
            point.setStatYear(src.getStatYear());
            point.setMonth(src.getMonth());
            point.setBullCount(src.getBullCount());
            point.setCowCount(src.getCowCount());
            list.add(point);
        }
        return list;
    }

    public static List<BreedingIndustryAgeBandVo> toAgeStructure(List<HomeScreenAgeBandVo> from)
    {
        if (from == null || from.isEmpty())
        {
            return Collections.emptyList();
        }
        List<BreedingIndustryAgeBandVo> list = new ArrayList<>(from.size());
        for (HomeScreenAgeBandVo src : from)
        {
            BreedingIndustryAgeBandVo band = new BreedingIndustryAgeBandVo();
            band.setBandCode(src.getBandCode());
            band.setBandLabel(src.getBandLabel());
            band.setCount(src.getCount());
            band.setRatio(src.getRatio());
            list.add(band);
        }
        return list;
    }
}
