package com.ruoyi.file.request;

import cn.hutool.core.bean.BeanUtil;
import com.ruoyi.common.utils.StringUtils;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.util.Map;

@Data
public class RuralCollectiveAssetsBaseReq
{
    @NotBlank(message = "服务标识不能为空")
    private String token;

    private String authorization; // api_token 如果为空, 重定向则不携带身份认证

    public Map<String, Object> toMap(String...rmNames)
    {
        Map<String, Object> map = BeanUtil.beanToMap(this, false, true);
        map.remove("token");
        map.remove("authorization");
        if(null != rmNames)
        {
            for(String rmName : rmNames)
            {
                map.remove(rmName);
            }
        }
        return map;
    }

    public boolean withAuthorization()
    {
        return StringUtils.isNotEmpty(authorization);
    }
}
