package main

import (
	"fmt"
	"os"

	"git.apinb.com/ops/sample/internal/config"
	"git.apinb.com/ops/sample/internal/impl"
	_ "git.apinb.com/ops/sample/internal/models"
)

const (
	serviceKey = "Sample"
	version    = "1.0.0"
)

func main() {
	if len(os.Args) < 2 {
		printUsage()
		return
	}

	switch os.Args[1] {
	case "version":
		fmt.Println("sample-cli", version)
	case "migrate":
		config.New(serviceKey)
		impl.NewImpl()
		fmt.Println("database migrate completed")
	default:
		fmt.Fprintf(os.Stderr, "unknown command: %s\n", os.Args[1])
		printUsage()
		os.Exit(1)
	}
}

func printUsage() {
	fmt.Println("usage: sample-cli <command>")
	fmt.Println("commands:")
	fmt.Println("  version   show cli version")
	fmt.Println("  migrate   run database auto migrate")
}
