package com.caliverse.admin.dynamodb.service;

import com.caliverse.admin.domain.entity.RankingSchedule;
import com.caliverse.admin.domain.request.RankRequest;
import com.caliverse.admin.dynamodb.repository.RankingSchedulerRepository;
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import software.amazon.awssdk.enhanced.dynamodb.Key;

@Service
@RequiredArgsConstructor
@Slf4j
public class DynamodbRankService {
    private final RankingSchedulerRepository rankingScheduleRepository;

    @DynamoDBTransaction
    public void insertRankingSchedule(RankRequest rankRequest) {
        rankingScheduleRepository.insert(rankRequest);
    }

    @DynamoDBTransaction
    public void updateRankingSchedule(RankRequest rankRequest) {
        rankingScheduleRepository.update(rankRequest);
    }

    @DynamoDBTransaction
    public void deleteRankingSchedule(RankingSchedule rankingSchedule) {
        rankingScheduleRepository.delete(rankingSchedule.getGuid());
    }

}
