package queries

import (
	"bssapp-backend/models"
	"context"
)

func getStatementsForPDF(
	ctx context.Context,
	accountCode string,
	startDate string,
	endDate string,
	langCode string,
	parislemler []string,
) ([]models.StatementHeader, error) {
	return GetStatements(ctx, models.StatementParams{
		AccountCode: accountCode,
		StartDate:   startDate,
		EndDate:     endDate,
		LangCode:    langCode,
		Parislemler: parislemler,
	})
}

func collectBelgeNos(headers []models.StatementHeader) []string {
	seen := make(map[string]struct{}, len(headers))
	out := make([]string, 0, len(headers))
	for _, h := range headers {
		no := h.BelgeNo
		if no == "" || no == "Baslangic_devir" {
			continue
		}
		if _, ok := seen[no]; ok {
			continue
		}
		seen[no] = struct{}{}
		out = append(out, no)
	}
	return out
}
