package storage

import (
	"context"

	"github.com/tech/sendico/gateway/tgsettle/storage/model"
	"github.com/tech/sendico/pkg/merrors"
)

var ErrDuplicate = merrors.DataConflict("payment gateway storage: duplicate record")

type Repository interface {
	Payments() PaymentsStore
	TelegramConfirmations() TelegramConfirmationsStore
}

type PaymentsStore interface {
	FindByIdempotencyKey(ctx context.Context, key string) (*model.PaymentRecord, error)
	Upsert(ctx context.Context, record *model.PaymentRecord) error
}

type TelegramConfirmationsStore interface {
	Upsert(ctx context.Context, record *model.TelegramConfirmation) error
}
