package com.caliverse.admin.dynamodb.repository;

import com.caliverse.admin.domain.entity.EFilterOperator;
import com.caliverse.admin.dynamodb.dto.PageResult;
import software.amazon.awssdk.enhanced.dynamodb.Expression;
import software.amazon.awssdk.enhanced.dynamodb.Key;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;

import java.util.List;
import java.util.Map;

public interface DynamoDBRepository<T> {
    void save(T item);
    void saveWithCondition(T item, Expression condition);
    void update(T item);
    void updateWithCondition(T item, Expression condition);
    void delete(Key key);
    void deleteWithCondition(Key key, Expression condition);
    T findById(Key key);
    List<T> findAll(Key key);
    List<T> findAllScan(String prefix);
    List<T> findAllScan(String prefix, String sortKey);
    List<T> findByPrefix(String partitionKey, String sortKeyPrefix);
    PageResult<T> findByPaging(
            String partitionKey,
            String sortKeyPrefix,
            Map<String, AttributeValue> exclusiveStartKey
    );
    PageResult<T> findByPaging(
            String partitionKey,
            String sortKeyPrefix,
            String filterAttributeName,
            EFilterOperator filterOperator,
            String filterAttributeValue,
            Map<String, AttributeValue> exclusiveStartKey,
            boolean scanIndexForward
    );
}
