package main

import (
	"flag"
	"fmt"
	"os"

	"json2md/lib"
)

func main() {
	inputPath := flag.String("input", "", "Input JSON file path")
	outputPath := flag.String("output", "decisions.md", "Output Markdown file path")
	flag.Parse()

	if *inputPath == "" {
		fmt.Println("Error: --input parameter is required")
		os.Exit(1)
	}

	// Process JSON file using library
	data, err := lib.ProcessJSONFile(*inputPath)
	if err != nil {
		fmt.Printf("Error processing JSON file: %v\n", err)
		os.Exit(1)
	}

	// Generate Markdown using library
	if err := lib.GenerateMarkdown(data, *outputPath); err != nil {
		fmt.Printf("Error generating Markdown: %v\n", err)
		os.Exit(1)
	}

	fmt.Printf("Successfully generated Markdown file: %s\n", *outputPath)
}
