package com.iformall.domain.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.domain.po.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@TableName(value = "wx_mall")
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMall extends BaseEntity {

    protected Long id;


    @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId")
	private String tenantId;
	@io.swagger.annotations.ApiModelProperty(value="商场名",name="name")
	private String name;
	@io.swagger.annotations.ApiModelProperty(value="集团",name="group")
	private String group;
	@io.swagger.annotations.ApiModelProperty(value="国家",name="country")
	private String country;
	@io.swagger.annotations.ApiModelProperty(value="省",name="province")
	private String province;
	@io.swagger.annotations.ApiModelProperty(value="城市",name="city")
	private String city;
	@io.swagger.annotations.ApiModelProperty(value="地址",name="addr")
	private String addr;
	@io.swagger.annotations.ApiModelProperty(value="总面积",name="totalArea")
	private BigDecimal totalArea;
	@io.swagger.annotations.ApiModelProperty(value="营业面积",name="operatingArea")
	private BigDecimal operatingArea;
	@io.swagger.annotations.ApiModelProperty(value="停车场面积",name="parkArea")
	private BigDecimal parkArea;
	@io.swagger.annotations.ApiModelProperty(value="车位数",name="parkPlaceNumber")
	private Integer parkPlaceNumber;
	@io.swagger.annotations.ApiModelProperty(value="电话",name="servicePhone")
	private String servicePhone;
	@io.swagger.annotations.ApiModelProperty(value="商场图标",name="imgUrl")
	private String imgUrl;
	@io.swagger.annotations.ApiModelProperty(value="商场图标-H",name="imgUrlH")
	private String imgUrlH;

    @io.swagger.annotations.ApiModelProperty(value="小程序提示",name="weapNote")
    private String weapNote;

	@io.swagger.annotations.ApiModelProperty(value="小程序二维码",name="imgQrcodeWeapp")
	private String imgQrcodeWeapp;
	@io.swagger.annotations.ApiModelProperty(value="公众平台二维码",name="imgQrcodeWemp")
	private String imgQrcodeWemp;

    @io.swagger.annotations.ApiModelProperty(value="分享标题",name="weappShareTitle")
    private String weappShareTitle;

    @io.swagger.annotations.ApiModelProperty(value="分享封面图片",name="weappShareCoverImg")
    private String weappShareCoverImg;

	@io.swagger.annotations.ApiModelProperty(value="POS小票二维码规则",name="posQrcodeRule")
	private String posQrcodeRule;

    @io.swagger.annotations.ApiModelProperty(value="销售类型",name="saleType")
    private Integer saleType;
    @io.swagger.annotations.ApiModelProperty(value="启用开始时间",name="validStart")
    private Date validStart;
	@io.swagger.annotations.ApiModelProperty(value = "启用结束时间", name = "validEnd")
	private Date validEnd;

	@TableField(exist = false)
	protected List<WxMallBuilding> buildings;

	@TableField(exist = false)
    private boolean valid;

	public boolean isValid() {
	    if(saleType != null) {
            if(validStart != null && validEnd != null) {
                Date curDate = new Date();
                if(curDate.before(validStart) || curDate.after(validEnd)) {
                    return false;
                } else {
                    return true;
                }
            }
        }

	    return true;
    }

	@io.swagger.annotations.ApiModelProperty(value = "营业时间", name = "businessHours")
	private String businessHours;

	@io.swagger.annotations.ApiModelProperty(value = "简介", name = "introduction")
	private String introduction;

	@io.swagger.annotations.ApiModelProperty(value = "图片", name = "img")
	private String img;

}
