package afterSale_rejectReasonCodeList_request

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

type AfterSaleRejectReasonCodeListRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *AfterSaleRejectReasonCodeListParam
}

func (c *AfterSaleRejectReasonCodeListRequest) GetUrlPath() string {
	return "/afterSale/rejectReasonCodeList"
}

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

}

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

}

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

func (c *AfterSaleRejectReasonCodeListRequest) GetParams() *AfterSaleRejectReasonCodeListParam {
	return c.Param
}

type AfterSaleRejectReasonCodeListParam struct {
	// 备注关联的售后ID
	AfterSaleId int64 `json:"after_sale_id"`
}
