package material_easyShuttle_request

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

type MaterialEasyShuttleRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *MaterialEasyShuttleParam
}

func (c *MaterialEasyShuttleRequest) GetUrlPath() string {
	return "/material/easyShuttle"
}

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

}

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

}

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

func (c *MaterialEasyShuttleRequest) GetParams() *MaterialEasyShuttleParam {
	return c.Param
}

type MaterialEasyShuttleParam struct {
	// 文件夹ID列表，对该文件夹下的文件夹或素材进行操作；0:开放平台；1:图片根目录；2:视频根目录；-1:回收站
	FolderIdList []string `json:"folder_id_list"`
	// 操作类型：to_recycle-移到回收站，delete_forever-删除
	OperateType string `json:"operate_type"`
	// 操作的素材类型，photo-图片，video-视频
	MaterialTypeList []string `json:"material_type_list"`
	// 是否只操作素材，true-只操作素材，false-操作子文件夹和素材
	OnlyMaterial bool `json:"only_material"`
	// 只对create_time_end之前创建的素材进行操作，默认取系统当前时间
	CreateTimeEnd string `json:"create_time_end"`
}
