package shop_editStore_request

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

type ShopEditStoreRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *ShopEditStoreParam
}

func (c *ShopEditStoreRequest) GetUrlPath() string {
	return "/shop/editStore"
}

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

}

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

}

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

func (c *ShopEditStoreRequest) GetParams() *ShopEditStoreParam {
	return c.Param
}

type OpenTime struct {
	// 营业时间
	DayMap map[int64]string `json:"day_map"`
}
type ShopEditStoreParam struct {
	// 门店ID
	StoreId int64 `json:"store_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"`
	// 营业时间
	OpenTime *OpenTime `json:"open_time"`
}
