package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	ascii_art()

	id := input("Quel est ton identifiant :")
	psw := input("Quel est mot de passe :")
	user_id, x_token := get_login_token(id, psw)
	fmt.Println("X-Token is: ", x_token)
	url := get_agenda_link(user_id, x_token)
	fmt.Println("URL is: ", url)
}

func input(s string) string {
	reader := bufio.NewReader(os.Stdin)
	fmt.Print(s)

	text, err := reader.ReadString('\n')
	if err != nil {
		panic(err)
	}

	return strings.ReplaceAll(text, "\n", "")
}

func ascii_art() {
	fmt.Println(`
   ____         __    ___  _             __        ___   ___  ____
  / __/______  / /__ / _ \(_)______ ____/ /____   / _ | / _ \/  _/
 / _// __/ _ \/ / -_) // / / __/ -_) __/ __/ -_) / __ |/ ___// /  
/___/\__/\___/_/\__/____/_/_/  \__/\__/\__/\__/ /_/ |_/_/  /___/  
                                                                  
 - Ayabusa, 2024
`)
}
