package com.utic.center.utic.traf.server.dao.repository.utic;

import com.utic.center.common.annotation.SqlOperation;
import com.utic.center.utic.traf.server.dao.mapper.utic.AsnDbMapper;
import com.utic.center.utic.traf.server.dto.AsnCenterDto;
import com.utic.center.utic.traf.server.dto.AsnCollectInfoDto;
import com.utic.center.utic.traf.server.dto.TrafPrcsTimeDto;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@RequiredArgsConstructor
public class AsnDbRepository {

    private final AsnDbMapper mapper;

    @SqlOperation(type = SqlOperation.SqlType.SELECT, table = "CENTER@ASNDB")
    public List<AsnCenterDto> findAllAsnCenter() {
        return this.mapper.findAllAsnCenter();
    }

    @SqlOperation(type = SqlOperation.SqlType.INSERT, table = "TRAFFIC_LOC")
    public int insertTrafficLoc(@Param("obj") TrafPrcsTimeDto obj) {
        return this.mapper.insertTrafficLoc(obj);
    }

    @SqlOperation(type = SqlOperation.SqlType.SELECT, table = "TRAFFIC_LOC")
    public List<AsnCollectInfoDto> findAllTrafficLocCount(@Param("obj") TrafPrcsTimeDto obj) {
        return this.mapper.findAllTrafficLocCount(obj);
    }

    @SqlOperation(type = SqlOperation.SqlType.INSERT, table = "PTAPP.INCIDENT_COMMON")
    public int insertIncidentCommon(@Param("obj") TrafPrcsTimeDto obj) {
        return this.mapper.insertIncidentCommon(obj);
    }

}
