package ink.wgink.module.wechat.pay.pojo.v3;

import ink.wgink.annotation.CheckBeanAnnotation;
import ink.wgink.annotation.CheckEmptyAnnotation;

/**
 * @ClassName: PayNotice
 * @Description: 支付通知
 * @Author: wanggeng
 * @Date: 2021/8/20 8:07 上午
 * @Version: 1.0
 */
public class PayNotice {

    @CheckEmptyAnnotation(name = "通知ID")
    private String id;
    @CheckEmptyAnnotation(name = "通知创建时间")
    private String create_time;
    @CheckEmptyAnnotation(name = "通知类型")
    private String event_type;
    @CheckEmptyAnnotation(name = "通知数据类型")
    private String resource_type;
    @CheckBeanAnnotation
    private Resource resource;
    @CheckEmptyAnnotation(name = "回调摘要")
    private String summary;

    public String getId() {
        return id == null ? "" : id.trim();
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCreate_time() {
        return create_time == null ? "" : create_time.trim();
    }

    public void setCreate_time(String create_time) {
        this.create_time = create_time;
    }

    public String getEvent_type() {
        return event_type == null ? "" : event_type.trim();
    }

    public void setEvent_type(String event_type) {
        this.event_type = event_type;
    }

    public String getResource_type() {
        return resource_type == null ? "" : resource_type.trim();
    }

    public void setResource_type(String resource_type) {
        this.resource_type = resource_type;
    }

    public Resource getResource() {
        return resource;
    }

    public void setResource(Resource resource) {
        this.resource = resource;
    }

    public String getSummary() {
        return summary == null ? "" : summary.trim();
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"id\":\"")
                .append(id).append('\"');
        sb.append(",\"create_time\":\"")
                .append(create_time).append('\"');
        sb.append(",\"event_type\":\"")
                .append(event_type).append('\"');
        sb.append(",\"resource_type\":\"")
                .append(resource_type).append('\"');
        sb.append(",\"resource\":")
                .append(resource);
        sb.append(",\"summary\":\"")
                .append(summary).append('\"');
        sb.append('}');
        return sb.toString();
    }

    public static class Resource {
        @CheckEmptyAnnotation(name = "加密算法类型")
        private String algorithm;
        @CheckEmptyAnnotation(name = "数据密文")
        private String ciphertext;
        /**
         * 附加数据
         */
        private String original_type;
        @CheckEmptyAnnotation(name = "原始类型")
        private String associated_data;
        @CheckEmptyAnnotation(name = "随机")
        private String nonce;

        public String getAlgorithm() {
            return algorithm == null ? "" : algorithm.trim();
        }

        public void setAlgorithm(String algorithm) {
            this.algorithm = algorithm;
        }

        public String getCiphertext() {
            return ciphertext == null ? "" : ciphertext.trim();
        }

        public void setCiphertext(String ciphertext) {
            this.ciphertext = ciphertext;
        }

        public String getOriginal_type() {
            return original_type == null ? "" : original_type.trim();
        }

        public void setOriginal_type(String original_type) {
            this.original_type = original_type;
        }

        public String getAssociated_data() {
            return associated_data == null ? "" : associated_data.trim();
        }

        public void setAssociated_data(String associated_data) {
            this.associated_data = associated_data;
        }

        public String getNonce() {
            return nonce == null ? "" : nonce.trim();
        }

        public void setNonce(String nonce) {
            this.nonce = nonce;
        }

        @Override
        public String toString() {
            final StringBuilder sb = new StringBuilder("{");
            sb.append("\"algorithm\":\"")
                    .append(algorithm).append('\"');
            sb.append(",\"ciphertext\":\"")
                    .append(ciphertext).append('\"');
            sb.append(",\"original_type\":\"")
                    .append(original_type).append('\"');
            sb.append(",\"associated_data\":\"")
                    .append(associated_data).append('\"');
            sb.append(",\"nonce\":\"")
                    .append(nonce).append('\"');
            sb.append('}');
            return sb.toString();
        }
    }
}
