package com.yonge.cooleshow.biz.dal.queryInfo;

import com.alibaba.fastjson.JSON;
import com.yonge.cooleshow.biz.dal.enums.coupon.CouponInventoryEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 优惠券查询条件
 * Created by Eric.Shang on 2022/9/2.
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CouponInventoryQuery implements Serializable {

    // 优惠券ID
    private Long couponId;
    // 操作人ID
    private Long userId;
    // 用户名称匹配
    private String keyword;
    // 调整类型
    private CouponInventoryEnum dataType;
    // 按用户分组
    private Boolean groupByUser;

    // 开始时间
    private Long startTime;
    // 结束时间
    private Long endTime;

    public static CouponInventoryQuery from(String recv) {

        return JSON.parseObject(recv, CouponInventoryQuery.class);
    }


    public CouponInventoryQuery groupByUser(Boolean groupByUser) {
        this.groupByUser = groupByUser;
        return this;
    }
}
