package com.its.vms.xnettcp.vms.process.response;

import com.its.app.utils.NettyUtils;
import com.its.vms.config.CommunicationConfig;
import com.its.vms.dto.TbVmsCtlrDto;
import com.its.vms.process.DbmsDataProcess;
import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class LogoutResponse implements VmsResponse {
    private TbVmsCtlrDto obj;
    private ChannelHandlerContext ctx;

    private DbmsDataProcess dbmsDataProcess;

    @Override
    public boolean response(CommunicationConfig communicationConfig) {
        String ipAddress = NettyUtils.getRemoteIpAddress(this.ctx.channel());
        log.info("LogoutResponse.response: {}", ipAddress);

        // 로그아웃 정보를 데이터베이스에 저장.
        if (this.dbmsDataProcess != null) {
//            TbRseCtlrCnncHs voLog = new TbRseCtlrCnncHs();
//            //voLog.setRSE_CTLR_NMBR(this.obj.getId());
//            voLog.setLOG_ADDRESS(NettyUtils.getRemoteIpAddress(this.ctx.channel()));
//            //voLog.setLoginInfo(this.c2c);
//            this.dbmsDataProcess.add(new DbmsData(DbmsDataType.DBMS_DATA_LOG_HS, false, voLog));
        }
        return true;
    }
}
