package com.cool.store.vo.point;

import com.alibaba.fastjson.JSONObject;
import com.cool.store.entity.ShopRentInfoDO;
import com.cool.store.enums.RentTypeEnum;
import com.cool.store.vo.AuditInfoVO;
import com.cool.store.vo.LineAuditInfoVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
import java.util.List;

/**
 * @author zhangchenbiao
 * @FileName: ShopRentInfoVO
 * @Description:
 * @date 2024-04-16 14:03
 */
@Data
public class ShopRentInfoVO {

    @ApiModelProperty("租赁id")
    private Long rentId;

    @ApiModelProperty("店铺id")
    private Long shopId;

    @ApiModelProperty("铺位id")
    private Long pointId;

    @ApiModelProperty("租赁类型 1铺位直租 2自有铺位")
    private Integer rentType;

    @ApiModelProperty("签约日期")
    private Date signTime;

    @ApiModelProperty("合同开始日期")
    private Date contractStartTime;

    @ApiModelProperty("合同结束日期")
    private Date contractEndTime;

    @ApiModelProperty("签约年限")
    private Integer contractMonths;

    @ApiModelProperty("店铺租金 1固定租金 2非固定租金")
    private Integer shopRentType;

    @ApiModelProperty("月租金")
    private String monthRent;

    @ApiModelProperty("第一年月租金")
    private String firstYearMonthRent;

    @ApiModelProperty("第二年月租金")
    private String secondYearMonthRent;

    @ApiModelProperty("第三年月租金")
    private String thirdYearMonthRent;

    @ApiModelProperty("合同图片")
    private List<String> contractPic;

    @ApiModelProperty("房产证明")
    private List<String> houseCertificatePic;

    @ApiModelProperty("状态")
    private Integer status;

    @ApiModelProperty("审核信息")
    private AuditInfoVO auditInfo;

    @ApiModelProperty("审批人")
    private String approver;

    public static ShopRentInfoVO build(ShopRentInfoDO shopRentInfo) {
        ShopRentInfoVO result = new ShopRentInfoVO();
        result.setRentId(shopRentInfo.getId());
        result.setShopId(shopRentInfo.getShopId());
        result.setPointId(shopRentInfo.getPointId());
        result.setRentType(shopRentInfo.getRentType());
        result.setSignTime(shopRentInfo.getSignTime());
        if(RentTypeEnum.RENT.getCode().equals(shopRentInfo.getRentType())){
            result.setContractStartTime(shopRentInfo.getContractStartTime());
            result.setContractEndTime(shopRentInfo.getContractEndTime());
            result.setContractMonths(shopRentInfo.getContractMonths());
        }
        result.setShopRentType(shopRentInfo.getShopRentType());
        result.setMonthRent(shopRentInfo.getMonthRent());
        result.setFirstYearMonthRent(shopRentInfo.getFirstYearMonthRent());
        result.setSecondYearMonthRent(shopRentInfo.getSecondYearMonthRent());
        result.setThirdYearMonthRent(shopRentInfo.getThirdYearMonthRent());
        result.setContractPic(JSONObject.parseArray(shopRentInfo.getContractPic(), String.class));
        result.setHouseCertificatePic(JSONObject.parseArray(shopRentInfo.getHouseCertificatePic(), String.class));
        return result;
    }

}
