package jnpf.model.store.vo;

import jnpf.entity.StoreEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * 门店位置信息
 *
 * @author shitou
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class StoreLocationVO {
    /**
     * 定位
     **/
    private String address;

    /**
     * 经度
     **/
    private String longitude;

    /**
     * 纬度
     **/
    private String latitude;

    public static StoreLocationVO convert(StoreEntity store) {
        if (Objects.isNull(store)) {
            return null;
        }
        return StoreLocationVO.builder()
                .address(store.getAddress())
                .longitude(store.getLongitude())
                .latitude(store.getLatitude())
                .build();
    }
}
