package org.jeecg.modules.adweb.api.vo;

import lombok.Data;

import org.jeecg.modules.adweb.common.util.DateUtil;
import org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiry;

/**
 * @author wfansh
 */
@Data
public class EnquiryInfoVO {

    private Long id;

    private String name;

    private String email;

    private String phone;

    private String message;

    private String pageUrl;

    private String siteHost;

    private String createTime;

    public static EnquiryInfoVO fromAdwebEnquiry(AdwebEnquiry adwebEnquiry) {
        EnquiryInfoVO enquiryInfoVO = new EnquiryInfoVO();
        enquiryInfoVO.setId(adwebEnquiry.getId());
        enquiryInfoVO.setName(adwebEnquiry.getName());
        enquiryInfoVO.setEmail(adwebEnquiry.getEmail());
        enquiryInfoVO.setPhone(adwebEnquiry.getPhone());
        enquiryInfoVO.setMessage(adwebEnquiry.getMessage());
        enquiryInfoVO.setPageUrl(adwebEnquiry.getFromPage());
        enquiryInfoVO.setSiteHost(adwebEnquiry.getSiteHost());
        enquiryInfoVO.setCreateTime(
                DateUtil.formatDate(adwebEnquiry.getRecordCtime(), DateUtil.DATE_FORMAT_MINUTE));

        return enquiryInfoVO;
    }
}
