package com.caliverse.admin.dynamodb.service;

import com.caliverse.admin.domain.entity.BattleEvent;
import com.caliverse.admin.domain.request.BattleEventRequest;
import com.caliverse.admin.dynamodb.repository.BattleEventRepository;
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
@Slf4j
public class DynamodbBattleEventService {
    private final BattleEventRepository battleEventRepository;

    @DynamoDBTransaction
    public void insertBattleEvent(BattleEventRequest battleEventRequest) {
        battleEventRepository.insert(battleEventRequest);
    }

    @DynamoDBTransaction
    public void updateBattleEvent(BattleEventRequest battleEventRequest) {
        battleEventRepository.update(battleEventRequest);
    }

    public int getEventId(){
        return battleEventRepository.findEventId();
    }

    @DynamoDBTransaction
    public void updateStopBattleEvent(BattleEvent battleEvent) {
        battleEventRepository.updateStop(battleEvent);
    }

}
