package main

import (
	"flag"
	"fmt"
	"log"
	"os"

	"vrc_osc_go/internal/consenttool"
)

func main() {
	var cfgPath string
	var mode string

	flag.StringVar(&cfgPath, "config", "config/consent.toml", "path to consent tool config")
	flag.StringVar(&mode, "mode", "", "generate-json or extract-log")
	flag.Parse()

	if mode == "" && flag.NArg() > 0 {
		mode = flag.Arg(0)
	}

	if mode == "" {
		fmt.Fprintln(os.Stderr, "missing mode: generate-json or extract-log")
		os.Exit(2)
	}

	if err := consenttool.Run(cfgPath, mode); err != nil {
		log.SetOutput(os.Stderr)
		log.Fatalf("vrwt_tool: %v", err)
	}
}
