package repository

import (
	"context"

	"github.com/genex/translate-service/internal/domain/entity"
)

// AddressMappingRepository defines the contract for address mapping persistence.
// Infrastructure layer must provide the concrete implementation.
type AddressMappingRepository interface {
	// Save persists an address mapping. If a mapping with the same ID exists, it is updated.
	Save(ctx context.Context, mapping *entity.AddressMapping) error

	// FindByInternalAddress looks up a mapping by its internal (platform) address.
	FindByInternalAddress(ctx context.Context, addr string) (*entity.AddressMapping, error)

	// FindByChainAddress looks up an active mapping by chain type and on-chain address.
	FindByChainAddress(ctx context.Context, chain, addr string) (*entity.AddressMapping, error)

	// FindByUserID returns all address mappings belonging to a user.
	FindByUserID(ctx context.Context, userID string) ([]*entity.AddressMapping, error)

	// Delete removes an address mapping by its ID.
	Delete(ctx context.Context, id string) error
}
