package org.tio.sitexxx.service.service.jpush.huawei.apns;

import com.alibaba.fastjson.annotation.JSONField;
import org.tio.sitexxx.service.service.jpush.huawei.util.ValidatorUtils;

/**
 * <pre>
 *    @author : vagrancy
 *    e-mail : 18050829067@163.com
 *    time   : 2025-02-21 11:02
 *    desc   :
 * </pre>
 */
public class ApnsHmsOptions {
    private static final int TEST_USER = 1;
    private static final int FORMAL_USER = 1;
    private static final int VOIP_USER = 1;

    @JSONField(name = "target_user_type")
    private Integer targetUserType;

    public Integer getTargetUserType() {
        return targetUserType;
    }

    private ApnsHmsOptions(Builder builder){
        this.targetUserType = builder.targetUserType;
    }

    public void check(){
        if (targetUserType != null) {
            ValidatorUtils.checkArgument(this.targetUserType.intValue() == TEST_USER
                            || this.targetUserType.intValue() == FORMAL_USER
                            || this.targetUserType.intValue() == VOIP_USER,
                    "targetUserType should be [TEST_USER: 1, FORMAL_USER: 2, VOIP_USER: 3]");
        }
    }

    /**
     * builder
     */
    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private Integer targetUserType;

        public Builder setTargetUserType(Integer targetUserType) {
            this.targetUserType = targetUserType;
            return this;
        }

        public ApnsHmsOptions build(){
            return new ApnsHmsOptions(this);
        }
    }

}
