package baidunavi

import (
	"fmt"
	"testing"

	"git.rosy.net.cn/baseapi"
	"git.rosy.net.cn/baseapi/utils"

	"go.uber.org/zap"
)

var (
	api         *API
	sugarLogger *zap.SugaredLogger
)

func init() {
	logger, _ := zap.NewDevelopment()
	sugarLogger = logger.Sugar()
	baseapi.Init(sugarLogger)

	//api = New("eL94zToVOdGDTkNQxV8dnEQ1ZRcB2UKb", "ZG0OOpOsOVURUwAkkmoHQFKRCbzn0zGb")
	//api = New("wW2AwzPS0hdaPy5QLalzso7ARX5uYZtZ", "ZG0OOpOsOVURUwAkkmoHQFKRCbzn0zGb")
	api = New("wW2AwzPS0hdaPy5QLalzso7ARX5uYZtZ", "")
}

func TestBatchCoordinateConvert(t *testing.T) {
	result, err := api.BatchCoordinateConvert([]*Coordinate{
		&Coordinate{
			Lng: 104.057367,
			Lat: 30.694686,
		},
		&Coordinate{
			Lng: 104.057367,
			Lat: 30.694686,
		},
	}, CoordSysGCJ02, CoordSysBaiDu)
	if err != nil {
		t.Fatalf("TestCoordinateConvert failed with error:%v", err)
	} else {
		t.Log(utils.Format4Output(result, false))
	}
}

func TestDirectionLiteRide(t *testing.T) {
	result, err := api.DirectionLiteRide([]*Coordinate{
		{
			Lng: 104.063285,
			Lat: 30.571255,
		},
		&Coordinate{
			Lng: 104.065132,
			Lat: 30.610506,
		},
	})

	fmt.Println(err)
	fmt.Println(result)

}

func TestName(t *testing.T) {
	syncStatus := 1
	syncStatus |= 32
	fmt.Println(syncStatus)

}
