package signing

import (
	"context"
	"time"

	"github.com/tech/sendico/edge/callbacks/internal/secrets"
	"github.com/tech/sendico/pkg/mlogger"
)

const (
	ModeNone       = "none"
	ModeHMACSHA256 = "hmac_sha256"
)

// SignedPayload is what gets sent over HTTP.
type SignedPayload struct {
	Body    []byte
	Headers map[string]string
}

// Signer signs callback payloads.
type Signer interface {
	Sign(ctx context.Context, mode, secretRef string, payload []byte, now time.Time) (*SignedPayload, error)
}

// Dependencies configures signer service.
type Dependencies struct {
	Logger   mlogger.Logger
	Provider secrets.Provider
}

// New creates signer service.
func New(deps Dependencies) (Signer, error) {
	return newService(deps)
}
