package test

import (
	"context"
	"fmt"
	"gitea.cdlsxd.cn/self-tools/l_msg_api"
	"testing"
)

const (
	ClientKey    = "ymt"
	ClientSecret = "ymt"
	serverHost   = "http://120.55.12.245:8200"
	local        = "http://127.0.0.1:8001"
)

func TestSms(t *testing.T) {
	msg, err := l_msg_api.NewMessageCenter(serverHost, ClientKey, ClientSecret, "smssass", "sasssms")
	if err != nil {
		panic(err)
	}

	res, err := msg.SendSms([]string{"15082245107"}, `{"content": "测试"}`)
	fmt.Println(res, err)

}

func TestOaCreate(t *testing.T) {
	msg, err := l_msg_api.NewMessageCenter(local, ClientKey, ClientSecret, "sw_oa", "sw_oa_purchase")
	if err != nil {
		panic(err)
	}
	form := []l_msg_api.FormComponentValues{
		{Name: "采购单号", Value: "123456789123"},
		{Name: "供应商", Value: "测试供应商"},
		{Name: "采购总数量", Value: "1"},
		{Name: "入库仓库", Value: "测试仓库"},
		{Name: "采购总金额", Value: "11.22"},
		{Name: "预计到货时间", Value: "2025-03-21"},
	}
	res, err := msg.OACreate("17101201090101570", "cxvxvxcgfgfvxvxv", &l_msg_api.FormsData{
		FormComponentValues: form,
		Finance: &l_msg_api.Finance{
			Amount:         "11.22",
			CheckUserId:    "17109839571135417",
			GoodsInfo:      "实物系统测试商品",
			PaymentAccount: "1312312321",
			TaxAmount:      "1",
			CallbackUrl:    "www.baidu.com",
			Remark:         "测试备注",
			Sync:           1,
			SystemName:     "货易通",
			SubjectName:    "成都蓝色兄弟网络科技有限公司(0802)",
			BankInfo: l_msg_api.BankInfo{
				BankName:        "中国银行",
				BankAccount:     "43243243434",
				AccountBankName: "中国银行成都分行",
				ResellerName:    "张三",
				SubjectName:     "张三",
			},
		},
	})
	fmt.Println(res, err)
}

func TestOaComment(t *testing.T) {
	msg, err := l_msg_api.NewMessageCenter(serverHost, ClientKey, ClientSecret, "sw_oa", "sw_oa_purchase")
	if err != nil {
		panic(err)
	}
	res, err := msg.OAComment("P24110515152043136-20250318181554", "sdk测试", "", nil)
	fmt.Println(res, err)
}

func TestContext(*testing.T) {
	c := context.Background()
	c.Done()
}