package com.cool.store.entity;

import com.cool.store.request.SysStoreAppRequest;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.Date;
import java.util.Objects;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "xfsg_system_building_shop")
public class SystemBuildingShopDO {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    @Column(name = "shop_id")
    private Long shopId;
    @Column(name = "line_id")
    private Long lineId;
    @Column(name = "audit_id")
    private Long auditId;
    @Column(name = "franchisee_type")
    private Integer franchiseeType;
    @Column(name = "store_invitees_name")
    private String storeInviteesName;
    @Column(name = "store_invitees_id")
    private String storeInviteesId;
    @Column(name = "store_nature")
    private Integer storeNature;
    @Column(name = "store_operator")
    private Integer storeOperator;
    @Column(name = "big_desc")
    private String bigDesc;
    @Column(name = "big_name")
    private String bigName;
    @Column(name = "big_code")
    private String bigCode;
    @Column(name = "fight_desc")
    private String fightDesc;
    @Column(name = "fight_name")
    private String fightName;
    @Column(name = "fight_code")
    private String fightCode;
    @Column(name = "small_code")
    private String smallCode;
    @Column(name = "small_desc")
    private String smallDesc;
    @Column(name = "small_name")
    private String smallName;
    @Column(name = "main_business_type")
    private Integer mainBusinessType;
    @Column(name = "sub_business_type")
    private Integer subBusinessType;
    @Column(name = "offline_competitor")
    private Integer offlineCompetitor;
    @Column(name = "offline_competing_brand")
    private String offlineCompetingBrand;
    @Column(name = "average_price_sh")
    private Integer averagePriceSh;
    @Column(name = "average_daily_rs")
    private Integer averageDailyRs;
    @Column(name = "business_store_type")
    private String businessStoreType;
    @Column(name = "estimated_turnover")
    private Integer estimatedTurnover;
    @Column(name = "sign_date")
    private Date signDate;
    @Column(name = "landlord_name")
    private String landlordName;
    @Column(name = "contract_delivery_date")
    private Date contractDeliveryDate;
    @Column(name = "landlord_mobile")
    private String landlordMobile;
    @Column(name = "reservation")
    private Date reservation;
    @Column(name = "store_rent")
    private Integer storeRent;
    @Column(name = "store_franchise_fee")
    private Integer storeFranchiseFee;
    @Column(name = "store_security_deposit")
    private Integer storeSecurityDeposit;
    @Column(name = "reasons")
    private String reasons;
    @Column(name = "supervisor_name")
    private String supervisorName;
    @Column(name = "supervisor_id")
    private String supervisorId;
    @Column(name = "regio_general")
    private String regioGeneral;
    @Column(name = "regio_general_id")
    private String regioGeneralId;
    @Column(name = "create_time")
    private Date createTime;
    @Column(name = "update_time")
    private Date updateTime;
    @Column(name = "store_name")
    private String storeName;
    @Column(name = "usage_rate")
    private String usageRate;



    public static SystemBuildingShopDO convertToSystemBuildingShopDO(SysStoreAppRequest sysStoreAppRequest) {
        if (Objects.isNull(sysStoreAppRequest)) {
            return null;
        }
        SystemBuildingShopDO systemBuildingShopDO = new SystemBuildingShopDO();
        // id
        // shopInfoId
        systemBuildingShopDO.setShopId(sysStoreAppRequest.getShopId());
        // lineId
        systemBuildingShopDO.setLineId(sysStoreAppRequest.getLineId());
        // franchiseeType
        systemBuildingShopDO.setFranchiseeType(sysStoreAppRequest.getFranInfo().getFranchiseeType());
        // storeInviteesName
        systemBuildingShopDO.setStoreInviteesName(sysStoreAppRequest.getFranInfo().getStoreInviteesName());
//        // storeInviteesId
        systemBuildingShopDO.setStoreInviteesId(sysStoreAppRequest.getFranInfo().getInviteUserId());
        // storeNature
        systemBuildingShopDO.setStoreNature(sysStoreAppRequest.getStoreDetail().getStoreNature());
        // storeOperator
//        systemBuildingShopDO.setStoreOperator(sysStoreAppRequest.getStoreDetail().getstore);
        // bigDesc
        systemBuildingShopDO.setBigDesc(sysStoreAppRequest.getStoreDetail().getBigDesc());
        // fightDesc
        systemBuildingShopDO.setFightDesc(sysStoreAppRequest.getStoreDetail().getFightDesc());
        // smallCode
        systemBuildingShopDO.setSmallCode(sysStoreAppRequest.getStoreDetail().getSmallCode());
        // smallDesc
        systemBuildingShopDO.setSmallDesc(sysStoreAppRequest.getStoreDetail().getSmallDesc());
        // mainBusinessType
        systemBuildingShopDO.setMainBusinessType(sysStoreAppRequest.getStoreDetail().getMainBusinessType());
        // subBusinessType
        systemBuildingShopDO.setSubBusinessType(sysStoreAppRequest.getStoreDetail().getSubBusinessType());
        // offlineCompetitor
        systemBuildingShopDO.setOfflineCompetitor(sysStoreAppRequest.getStoreDetail().getOfflineCompetitor());
        // offlineCompetingBrand
        systemBuildingShopDO.setOfflineCompetingBrand(sysStoreAppRequest.getStoreDetail().getOfflineCompetingBrand());
        // averagePriceSh
        systemBuildingShopDO.setAveragePriceSh(sysStoreAppRequest.getStoreDetail().getAveragePriceSh());
        // averageDailyRs
        systemBuildingShopDO.setAverageDailyRs(sysStoreAppRequest.getStoreDetail().getAverageDailyRs());
        // businessStoreType
        systemBuildingShopDO.setBusinessStoreType(sysStoreAppRequest.getStoreDetail().getBusinessStoreType());
        // estimatedTurnover
        systemBuildingShopDO.setEstimatedTurnover(sysStoreAppRequest.getStoreDetail().getEstimatedTurnover());
        // signDate
        systemBuildingShopDO.setSignDate(sysStoreAppRequest.getStoreDetail().getSignDate());
        // landlordName
        systemBuildingShopDO.setLandlordName(sysStoreAppRequest.getStoreDetail().getLandlordName());
        // contractDeliveryDate
        systemBuildingShopDO.setContractDeliveryDate(sysStoreAppRequest.getStoreDetail().getContractDeliveryDate());
        // landlordMobile
        systemBuildingShopDO.setLandlordMobile(sysStoreAppRequest.getStoreDetail().getLandlordMobile());
        // reservation
        systemBuildingShopDO.setReservation(sysStoreAppRequest.getStoreDetail().getReservation());
        // storeRent
        systemBuildingShopDO.setStoreRent(sysStoreAppRequest.getStoreDetail().getStoreRent());
        // storeFranchiseFee
        systemBuildingShopDO.setStoreFranchiseFee(sysStoreAppRequest.getStoreDetail().getStoreFranchiseFee());
        // storeSecurityDeposit
        systemBuildingShopDO.setStoreSecurityDeposit(sysStoreAppRequest.getStoreDetail().getStoreSecurityDeposit());
        // reasons
        systemBuildingShopDO.setReasons(sysStoreAppRequest.getStoreDetail().getReasons());
        // supervisorName
        systemBuildingShopDO.setSupervisorName(sysStoreAppRequest.getSupervisorDetail().getSupervisorName());
        // supervisorId
        systemBuildingShopDO.setSupervisorId(sysStoreAppRequest.getSupervisorDetail().getSupervisorId());
        // regioGeneral
        systemBuildingShopDO.setRegioGeneral(sysStoreAppRequest.getSupervisorDetail().getRegioGeneral());
        // regioGeneralId
        systemBuildingShopDO.setRegioGeneralId(sysStoreAppRequest.getSupervisorDetail().getRegioGeneralId());
        systemBuildingShopDO.setStoreName(sysStoreAppRequest.getStoreDetail().getStoreName());
        systemBuildingShopDO.setBigName(sysStoreAppRequest.getStoreDetail().getBigName());
        systemBuildingShopDO.setBigCode(sysStoreAppRequest.getStoreDetail().getBigCode());
        systemBuildingShopDO.setFightName(sysStoreAppRequest.getStoreDetail().getFightName());
        systemBuildingShopDO.setFightCode(sysStoreAppRequest.getStoreDetail().getFightCode());
        systemBuildingShopDO.setSmallName(sysStoreAppRequest.getStoreDetail().getSmallName());
        systemBuildingShopDO.setUsageRate(sysStoreAppRequest.getStoreDetail().getUsageRate());
        systemBuildingShopDO.setStoreOperator(sysStoreAppRequest.getStoreDetail().getStoreOperator());
        return systemBuildingShopDO;
    }
}
