package cn.feast.coding.bean;

import cn.feast.coding.model.order.OrderStatis;

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

public class PieChartData {
    private String name;
    private List<DataItem> data;

    public PieChartData() {
    }

    public PieChartData(String name, List<OrderStatis> statisList) {
        this.name = name;
        this.data = new ArrayList<>();
       for(OrderStatis orderStatis : statisList){
           DataItem dataItem = new DataItem(orderStatis.getOrderType(), orderStatis.getOrderTotal());
           data.add(dataItem);
       }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<DataItem> getData() {
        return data;
    }

    public void setData(List<DataItem> data) {
        this.data = data;
    }
}

class DataItem{
    private String name;
    private Object y;

    public DataItem() {
    }

    public DataItem(String name, Object y) {
        this.name = name;
        this.y = y;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Object getY() {
        return y;
    }

    public void setY(Object y) {
        this.y = y;
    }
}