package repositories

import (
	"context"

	"github.com/google/uuid"
	"github.com/rwadurian/mpc-system/services/server-party/domain/entities"
)

// KeyShareRepository defines the interface for key share persistence
type KeyShareRepository interface {
	// Save persists a new key share
	Save(ctx context.Context, keyShare *entities.PartyKeyShare) error

	// FindByID retrieves a key share by ID
	FindByID(ctx context.Context, id uuid.UUID) (*entities.PartyKeyShare, error)

	// FindBySessionAndParty retrieves a key share by session and party
	FindBySessionAndParty(ctx context.Context, sessionID uuid.UUID, partyID string) (*entities.PartyKeyShare, error)

	// FindByPublicKey retrieves key shares by public key
	FindByPublicKey(ctx context.Context, publicKey []byte) ([]*entities.PartyKeyShare, error)

	// Update updates an existing key share
	Update(ctx context.Context, keyShare *entities.PartyKeyShare) error

	// Delete removes a key share
	Delete(ctx context.Context, id uuid.UUID) error

	// ListByParty lists all key shares for a party
	ListByParty(ctx context.Context, partyID string) ([]*entities.PartyKeyShare, error)
}
