package com.ytpm.advertise.param;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Size;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class  AddPlacementParam {
    /** 创建或修改的广告位数量 */
    private Integer count;
    /** 创建或修改的广告位的应用ID */
    private String app_id;
    /** 创建或修改的广告位信息列表 */
    @Size(min = 1,max = 100)
    private List<PlacementParam> placements;
    /**
     * taku公钥
     */
    private String takuPublicKey;

    public AddPlacementParam(com.ytpm.agent.param.PlacementParam param) {
        this.app_id = param.getAppId();
        PlacementParam placement = new PlacementParam();
        placement.setPlacement_id(param.getPlacementId());
        placement.setPlacement_name(param.getPlacementName());
        placement.setAdformat(param.getAdFormat());
        placement.setRemark(param.getRemark());
        placement.setStatus(param.getStatus());
        this.placements = Collections.singletonList(placement);
    }
}
