package com.ruoyi.xq.dto.app.user;

import com.ruoyi.common.core.domain.PageQuery;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDate;

@Data
public class HomePageReq extends PageQuery {
    @Schema(hidden = true)
    private LocalDate birthdayBegin;
    @Schema(hidden = true)
    private LocalDate birthdayEnd;

    /**
     * 查询人是否实名认证
     */
    @Schema(hidden = true)
    private Integer certStatus = 0;
    /**
     * 查询人是否VIP
     */
    @Schema(hidden = true)
    private Integer vipStatus = 0;
    @Schema(description = "用户编号")
    private String usercode;
    @Schema(description = "年龄-开始")
    private Integer ageBegin;
    @Schema(description = "年龄-结束")
    private Integer ageEnd;
    @Schema(description = "身高-开始")
    private Integer heightBegin;
    @Schema(description = "身高-结束")
    private Integer heightEnd;
    @Schema(description = "体重-开始")
    private Integer weightBegin;
    @Schema(description = "体重-结束")
    private Integer weightEnd;
    @Schema(description = "性别")
    private Integer gender;
    @Schema(description = "婚况")
    private Integer marriage;
    @Schema(description = "教育")
    private Integer education;
    @Schema(description = "居住城市编码")
    private String residenceCityCode;
//    @Schema(description = "居住地")
//    private Integer residenceCode;
//    @Schema(description = "居住地城市中文")
//    private String residenceCodeStr;
    @Schema(description = "VIP查询限制")
    private VipQuery vipQuery;

    @Data
    public static class VipQuery {
        @Schema(description = "职业")
        private String profession;
        @Schema(description = "年收入")
        private Integer annualIncome;
        @Schema(description = "生效")
        private Integer zodiac;
        @Schema(description = "星座")
        private Integer sign;
        @Schema(description = "小孩情况")
        private Integer childStatus;
        @Schema(description = "购房情况")
        private Integer housingStatus;
        @Schema(description = "购车情况")
        private Integer carStatus;
        @Schema(description = "户籍地")
        private Integer addressCode;
    }

    public void initBirthdayByAge(){
        if(this.ageBegin != null && this.ageBegin > 0){
            this.birthdayEnd = LocalDate.now().plusYears(-ageBegin);
        }
        if(this.ageEnd != null && this.ageEnd > 0){
            this.birthdayBegin= LocalDate.now().plusYears(-ageEnd);
        }
    }
}
