package request

type AlibabaWdkPictureUploadRequest struct {
	/*
	   图片分类ID，设置具体某个分类ID或设置0上传到默认分类，只能传入一个分类     */
	PictureCategoryId *int64 `json:"picture_category_id" required:"true" `
	/*
	   图片二进制文件流,不能为空,允许png、jpg、gif图片格式,3M以内     */
	Img *[]byte `json:"img" required:"true" `
	/*
	   包括后缀名的图片标题,不能为空，如Bule.jpg,有些卖家希望图片上传后取图片文件的默认名     */
	ImgInputTitle *string `json:"img_input_title,omitempty" required:"false" `
	/*
	   图片标题,如果为空,传的图片标题就取去掉后缀名的image_input_title,超过50字符长度会截取50字符,重名会在标题末尾加"(1)";标题末尾已经有"(数字)"了，则数字加1     */
	Title *string `json:"title,omitempty" required:"false" `
}

func (s *AlibabaWdkPictureUploadRequest) SetPictureCategoryId(v int64) *AlibabaWdkPictureUploadRequest {
	s.PictureCategoryId = &v
	return s
}
func (s *AlibabaWdkPictureUploadRequest) SetImg(v []byte) *AlibabaWdkPictureUploadRequest {
	s.Img = &v
	return s
}
func (s *AlibabaWdkPictureUploadRequest) SetImgInputTitle(v string) *AlibabaWdkPictureUploadRequest {
	s.ImgInputTitle = &v
	return s
}
func (s *AlibabaWdkPictureUploadRequest) SetTitle(v string) *AlibabaWdkPictureUploadRequest {
	s.Title = &v
	return s
}

func (req *AlibabaWdkPictureUploadRequest) ToMap() map[string]interface{} {
	paramMap := make(map[string]interface{})
	if req.PictureCategoryId != nil {
		paramMap["picture_category_id"] = *req.PictureCategoryId
	}
	if req.ImgInputTitle != nil {
		paramMap["img_input_title"] = *req.ImgInputTitle
	}
	if req.Title != nil {
		paramMap["title"] = *req.Title
	}
	return paramMap
}

func (req *AlibabaWdkPictureUploadRequest) ToFileMap() map[string]interface{} {
	fileMap := make(map[string]interface{})
	if req.Img != nil {
		fileMap["img"] = *req.Img
	}
	return fileMap
}
