package shop.alien.store.dto;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * 厂商推送单次发送结果（含用于统计查询的 task_id）
 */
@Data
public class CommonPushVendorSendResult {

    private boolean success;

    /** 厂商返回的任务 ID，如 vivo taskId、OPPO task_id、小米 msg_id */
    private String vendorTaskId;

    /** 附加 ID，如 OPPO 统计所需的 message_id */
    private String extraTaskId;

    public static CommonPushVendorSendResult fail() {
        CommonPushVendorSendResult result = new CommonPushVendorSendResult();
        result.setSuccess(false);
        return result;
    }

    public static CommonPushVendorSendResult ok(String vendorTaskId) {
        return ok(vendorTaskId, null);
    }

    public static CommonPushVendorSendResult ok(String vendorTaskId, String extraTaskId) {
        CommonPushVendorSendResult result = new CommonPushVendorSendResult();
        result.setSuccess(StringUtils.isNotBlank(vendorTaskId));
        result.setVendorTaskId(vendorTaskId);
        result.setExtraTaskId(extraTaskId);
        return result;
    }
}
