package batch_quote_processor_v2

import (
	"github.com/tech/sendico/payments/quotation/internal/service/quotation/transfer_intent_hydrator"
	quotationv2 "github.com/tech/sendico/pkg/proto/payments/quotation/v2"
	"go.mongodb.org/mongo-driver/v2/bson"
)

// BatchContext carries normalized request-level parameters for batch processing.
type BatchContext struct {
	OrganizationRef    string
	OrganizationID     bson.ObjectID
	InitiatorRef       string
	PreviewOnly        bool
	BaseIdempotencyKey string
}

// ProcessInput is the input contract for batch quote processing.
type ProcessInput struct {
	Context BatchContext
	Intents []*transfer_intent_hydrator.QuoteIntent
}

// BatchItem is one derived processing unit for a single intent.
type BatchItem struct {
	Index          int
	Count          int
	IdempotencyKey string
	Intent         *transfer_intent_hydrator.QuoteIntent
}

// SingleProcessInput is forwarded to the single-intent processor.
type SingleProcessInput struct {
	Context BatchContext
	Item    BatchItem
}

// SingleProcessOutput is returned by the single-intent processor.
type SingleProcessOutput struct {
	Quote *quotationv2.PaymentQuote
}

// BatchItemResult is one successful item output.
type BatchItemResult struct {
	Item  BatchItem
	Quote *quotationv2.PaymentQuote
}

// ProcessOutput is an ordered list of item outputs.
type ProcessOutput struct {
	Context BatchContext
	Items   []*BatchItemResult
}
