package com.cool.store.response;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.temporal.ChronoUnit;
import java.util.Date;
import java.util.List;

/**
 * @Author: WangShuo
 * @Date: 2025/01/08/下午5:46
 * @Version 1.0
 * @注释:
 */
@Data
public class BranchShopResponse {
    private Long shopId;
    private Long lineId;
    private Long pointId;
    @ApiModelProperty("门店类型")
    private Integer storeType;
    @ApiModelProperty("加盟商姓名")
    private String username;
    @ApiModelProperty("加盟商手机号")
    private String mobile;
    @ApiModelProperty("门店名称")
    private String shopName;
    private String shopAddress;
    @ApiModelProperty("门店编号")
    private String shopCode;
    @ApiModelProperty("所属大区")
    private String regionName;
    @ApiModelProperty("所属品牌")
    private String franchiseBrand;
    @ApiModelProperty("加盟模式")
    private Integer joinMode;
    @ApiModelProperty("意向开店区域")
    private String wantRegionName;
    @ApiModelProperty("计划开业时间")
    private Date planOpenTime;
    @ApiModelProperty("总项数")
    private Integer totalColumn;
    @ApiModelProperty("完成项")
    private Integer completionColumn;
    @ApiModelProperty("开店时长")
    private String days;
    @ApiModelProperty("督导/招商经理")
    private String investmentManagerName;
    @ApiModelProperty("状态")
    private String shopStatus;
    @ApiModelProperty("创建时间")
    private Date createTime;
    @ApiModelProperty("开业活动完成时间")
    private Date openingActivityEndTime;
    @ApiModelProperty("所属管理区域id")
    private Long managerRegionId;

    @ApiModelProperty("所属管理区域name")
    private String managerRegionName;


    public void setDays() {
        if (this.openingActivityEndTime==null){
            long between = ChronoUnit.SECONDS.between(this.createTime.toInstant(), new Date().toInstant());
            double days = (double) between / (24*60*60);
            this.days=String.format("%.1f", days);
        }else{
            long between = ChronoUnit.SECONDS.between(this.createTime.toInstant(), this.openingActivityEndTime.toInstant());
            double days = (double) between / (24*60*60);
            this.days = String.format("%.1f", days);
        }

    }
}
