package l10n_de

import "fmt"

// DIN5008Config holds the German business letter format configuration.
type DIN5008Config struct {
	// Type A: 27mm top margin, Type B: 45mm top margin
	Type          string // "A" or "B"
	PaperFormat   string // "A4"
	MarginTop     int    // mm
	MarginBottom  int    // mm
	MarginLeft    int    // mm
	MarginRight   int    // mm
	AddressFieldY int    // mm from top (Type A: 27mm, Type B: 45mm)
	InfoBlockX    int    // mm from left for info block
}

// DefaultDIN5008A returns Type A configuration.
func DefaultDIN5008A() DIN5008Config {
	return DIN5008Config{
		Type: "A", PaperFormat: "A4",
		MarginTop: 27, MarginBottom: 20,
		MarginLeft: 25, MarginRight: 20,
		AddressFieldY: 27, InfoBlockX: 125,
	}
}

// DATEVExportConfig holds configuration for DATEV accounting export.
type DATEVExportConfig struct {
	ConsultantNumber int    // Beraternummer
	ClientNumber     int    // Mandantennummer
	FiscalYearStart  string // YYYY-MM-DD
	ChartOfAccounts  string // "skr03" or "skr04"
	BookingType      string // "DTVF" (Datev-Format)
}

// FormatDATEVHeader generates the DATEV CSV header line.
func FormatDATEVHeader(cfg DATEVExportConfig) string {
	return "\"EXTF\";700;21;\"Buchungsstapel\";7;;" +
		fmt.Sprintf("%d;%d;", cfg.ConsultantNumber, cfg.ClientNumber) +
		cfg.FiscalYearStart + ";" + "4" + ";;" // 4 = length of fiscal year
}
