package com.tzld.piaoquan.ad.engine.service.feature;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class Feature {

    // k1:创意、k2:表、k3:特征、v:特征值
    private Map<String, Map<String, Map<String, String>>> cidFeature = new HashMap<>();

    // k1:视频、k2:表、v:特征值
    private Map<String, Map<String, String>> videoFeature = new HashMap<>();

    // k1: 广告主ID、k2:表、k3:特征、v:特征值
    private Map<String, Map<String, Map<String, String>>> adVerFeature = new HashMap<>();

    // k1:mid、k2:表、v:特征值
    private Map<String, Map<String, String>> userFeature = new HashMap<>();

    // k1:skuid、k2:表、v:特征值
    private Map<String, Map<String, Map<String, String>>> skuFeature = new HashMap<>();

    // other
    private Map<String, Map<String, Map<String, String>>> otherFeature = new HashMap<>();

    // 合并方法，使用 putAll() 合并，且如果目标为空则取源
    public void merge(Feature other) {
        this.cidFeature.putAll(other.cidFeature);
        this.videoFeature.putAll(other.videoFeature);
        this.adVerFeature.putAll(other.adVerFeature);
        this.userFeature.putAll(other.userFeature);
        this.skuFeature.putAll(other.skuFeature);
        this.otherFeature.putAll(other.otherFeature);
    }
}
