package com.ruoyi.bst.area.service.impl;

import org.springframework.stereotype.Service;

import com.ruoyi.bst.area.domain.Area;
import com.ruoyi.bst.area.service.AreaConverter;

@Service
public class AreaConverterImpl implements AreaConverter {

    @Override
    public Area toPoByCreate(Area data) {
        if (data == null) {
            return null;
        }
        Area po = new Area();
        // 基础信息
        po.setCreateId(data.getCreateId());
        po.setUserId(data.getUserId());
        po.setName(data.getName());
        po.setContact(data.getContact());
        po.setPhone(data.getPhone());
        po.setStatus(data.getStatus());
        po.setAreaTimeStart(data.getAreaTimeStart());
        po.setAreaTimeEnd(data.getAreaTimeEnd());

        // 骑行设置
        po.setUndercharge(data.getUndercharge());
        po.setAuthentication(data.getAuthentication());
        po.setMsgSwitch(data.getMsgSwitch());
        po.setNoRidingOutage(data.getNoRidingOutage());
        po.setAreaOutOutage(data.getAreaOutOutage());
        po.setBoundaryDistance(data.getBoundaryDistance());
        po.setOutageDistance(data.getOutageDistance());
        po.setTimeoutLock(data.getTimeoutLock());

        // 还车设置
        po.setError(data.getError());
        po.setReturnVerify(data.getReturnVerify());
        po.setParkingReturn(data.getParkingReturn());
        po.setAreaOutReturn(data.getAreaOutReturn());
        po.setDispatchFee(data.getDispatchFee());
        po.setVehicleManagementFee(data.getVehicleManagementFee());

        // 运营区设置
        po.setLatitude(data.getLatitude());
        po.setLongitude(data.getLongitude());
        po.setBoundaryStr(data.getBoundaryStr());
        po.setRingRadius(data.getRingRadius());
        po.setRequiredRingRadius(data.getRequiredRingRadius());

        return po;
    }

    @Override
    public Area toPoByUpdate(Area data) {
        if (data == null) {
            return null;
        }
        Area po = new Area();
        po.setId(data.getId());
        po.setUserId(data.getUserId());
        po.setName(data.getName());
        po.setContact(data.getContact());
        po.setPhone(data.getPhone());
        po.setStatus(data.getStatus());
        po.setAreaTimeStart(data.getAreaTimeStart());
        po.setAreaTimeEnd(data.getAreaTimeEnd());

        // 骑行设置
        po.setUndercharge(data.getUndercharge());
        po.setAuthentication(data.getAuthentication());
        po.setMsgSwitch(data.getMsgSwitch());
        po.setNoRidingOutage(data.getNoRidingOutage());
        po.setAreaOutOutage(data.getAreaOutOutage());
        po.setBoundaryDistance(data.getBoundaryDistance());
        po.setOutageDistance(data.getOutageDistance());
        po.setTimeoutLock(data.getTimeoutLock());
        
        // 还车设置
        po.setError(data.getError());
        po.setReturnVerify(data.getReturnVerify());
        po.setParkingReturn(data.getParkingReturn());
        po.setAreaOutReturn(data.getAreaOutReturn());
        po.setDispatchFee(data.getDispatchFee());
        po.setVehicleManagementFee(data.getVehicleManagementFee());

        // 运营区设置
        po.setLatitude(data.getLatitude());
        po.setLongitude(data.getLongitude());
        po.setBoundaryStr(data.getBoundaryStr());
        po.setRingRadius(data.getRingRadius());
        po.setRingRadius(data.getRingRadius());
        po.setRequiredRingRadius(data.getRequiredRingRadius());

        return po;
    }
}
