package cn.com.qmth.stmms.biz.common.domain.card;

import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

/**
 * 裁切坐标
 */
public class SliceConfig {

    private List<ConfigItem> items;

    public SliceConfig() {
        this.items = new LinkedList<>();
    }

    public void addConfig(int number, int left, int top, int width, int height) {
        ConfigItem item = new ConfigItem();
        item.number = number;
        item.left = left;
        item.top = top;
        item.width = width;
        item.height = height;
        this.items.add(item);
    }

    @Override
    public String toString() {
        return StringUtils.join(items, ",");
    }

    static class ConfigItem {

        int number, left, top, width, height;

        @Override
        public String toString() {
            return StringUtils.join(Arrays.asList(number, left, top, width, height), ":");
        }
    }
}
