package com.yonge.cooleshow.auth.dal.wrapper;

import com.alibaba.fastjson.JSON;
import com.microsvc.toolkit.common.response.paging.QueryInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Optional;

/**
 * 微信模板配置
 * 2023-02-01 14:21:57
 */
@ApiModel(value = "WxTemplateConfigWrapper对象", description = "微信模板配置查询对象")
public class WxTemplateConfigWrapper {

    @Data
	@Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(" WxTemplateConfigQuery-微信模板配置")
    public static class WxTemplateConfigQuery implements QueryInfo {

    	@ApiModelProperty("当前页")
        private Integer page;

        @ApiModelProperty("分页行数")
        private Integer rows;

        @ApiModelProperty("关键字匹配")
		private String keyword;

        public String getKeyword() {
            return Optional.ofNullable(keyword).filter(StringUtils::isNotBlank).orElse(null);
        }

        public String jsonString() {
            return JSON.toJSONString(this);
        }

        public static WxTemplateConfigQuery from(String json) {
            return JSON.parseObject(json, WxTemplateConfigQuery.class);
        }
    }

	@ApiModel(" WxTemplateConfig-微信模板配置")
    public static class WxTemplateConfig {

        public String jsonString() {
            return JSON.toJSONString(this);
        }

        public static WxTemplateConfig from(String json) {
            return JSON.parseObject(json, WxTemplateConfig.class);
        }
	}

}
