package com.sikey.wa04.business.infrastructure.adapter.dao;

import com.sikey.wa04.business.domain.adapter.MapTrajectoryAdapter;
import com.sikey.wa04.business.domain.entity.MapTrajectory;
import com.sikey.wa04.business.infrastructure.convert.MapTrajectoryConvert;
import com.sikey.wa04.business.infrastructure.dto.model.MapTrajectoryModel;
import com.sikey.wa04.business.infrastructure.repository.MapTrajectoryRepository;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @Author: qin
 * @Date: 2025/3/11
 * @Description: 实现地图轨迹适配器
 */
@Slf4j
@Component
public class MapTrajectoryAdapterImpl implements MapTrajectoryAdapter {

    @Resource
    private MapTrajectoryRepository mapTrajectoryRepository;

    /**
     * 保存地图轨迹
     *
     * @param mapTrajectory 地图轨迹
     */
    @Override
    public void save(MapTrajectory mapTrajectory) {
        MapTrajectoryModel mapTrajectoryModel = MapTrajectoryConvert.INSTANCE.convert(mapTrajectory);
        mapTrajectoryRepository.save(mapTrajectoryModel);
    }
}
