package com.slodon.b2b2c.vo.api;


import lombok.Data;


@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 EnquiryInfoVO enquiryInfoVOConverter() {
        EnquiryInfoVO vo = new EnquiryInfoVO();
        vo.setId(id);
        vo.setName(name);
        vo.setEmail(email);
        vo.setPhone(phone);
        vo.setMessage(message);
        vo.setPageUrl(pageUrl);
        vo.setSiteHost(removeHttpsPrefix(pageUrl));
        vo.setCreateTime(createTime);
        return vo;
    }

    public String removeHttpsPrefix(String url) {
        if (url != null && url.startsWith("https://")) {
            return url.substring("https://".length());
        }else if (url != null && url.startsWith("http://")) {
            return url.substring("http://".length());
        }
        return url; // 如果不是以 http[s]:// 开头，或者为 null，则原样返回
    }


}
