package shop_batchCreateStore_request

import (
	"encoding/json"
	shop_batchCreateStore_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_batchCreateStore/response"
	doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
)

type ShopBatchCreateStoreRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *ShopBatchCreateStoreParam
}

func (c *ShopBatchCreateStoreRequest) GetUrlPath() string {
	return "/shop/batchCreateStore"
}

func New() *ShopBatchCreateStoreRequest {
	request := &ShopBatchCreateStoreRequest{
		Param: &ShopBatchCreateStoreParam{},
	}
	request.SetConfig(doudian_sdk.GlobalConfig)
	request.SetClient(doudian_sdk.DefaultDoudianOpApiClient)
	return request

}

func (c *ShopBatchCreateStoreRequest) Execute(accessToken *doudian_sdk.AccessToken) (*shop_batchCreateStore_response.ShopBatchCreateStoreResponse, error) {
	responseJson, err := c.GetClient().Request(c, accessToken)
	if err != nil {
		return nil, err
	}
	response := &shop_batchCreateStore_response.ShopBatchCreateStoreResponse{}
	_ = json.Unmarshal([]byte(responseJson), response)
	return response, nil

}

func (c *ShopBatchCreateStoreRequest) GetParamObject() interface{} {
	return c.Param
}

func (c *ShopBatchCreateStoreRequest) GetParams() *ShopBatchCreateStoreParam {
	return c.Param
}

type ShopBatchCreateStoreParam struct {
	// 与createStore接口入参一致
	StoreList []StoreListItem `json:"store_list"`
}
type OpenTime struct {
	// Key:用数字表示周几，例：1:周一、2:周一、5:周五、6:周六、7:周日。Value: 营业时间，例：“x-x”。x的区间：[00:00, 23:59]（24:00无效）。营业到次日举例："19:00-02:00"。完整举例(周3周4不营业)：{1:"12:00-16:00",2:"12:00-16:00",5:"19:00-02:00",6:"12:00-16:00",7:"12:00-16:00"}
	DayMap map[int64]string `json:"day_map"`
}
type StoreListItem struct {
	// 标识这行数据
	RowId int64 `json:"row_id"`
	// 门店名称
	Name string `json:"name"`
	// 门店编码
	StoreCode string `json:"store_code"`
	// 经度
	Longitude string `json:"longitude"`
	// 纬度
	Latitude string `json:"latitude"`
	// 省份
	Province string `json:"province"`
	// 市
	City string `json:"city"`
	// 区
	District string `json:"district"`
	// 详细地址
	Address string `json:"address"`
	// 电话
	Contact string `json:"contact"`
	// Key:用数字表示周几，例：1:周一、2:周一、5:周五、6:周六、7:周日。Value: 营业时间，例：“x-x”。x的区间：[00:00, 23:59]（24:00无效）。营业到次日举例："19:00-02:00"。完整举例(周3周4不营业)：{1:"12:00-16:00",2:"12:00-16:00",5:"19:00-02:00",6:"12:00-16:00",7:"12:00-16:00"}
	OpenTime *OpenTime `json:"open_time"`
}
