package document_request

import (
	"encoding/json"
	"git.sxidc.com/student-physical-examination/contract_lock_sdk/http"
	"git.sxidc.com/student-physical-examination/contract_lock_sdk/model/common"
	"os"
)

type DocumentAddcontractattachmentRequest struct {
	// <ext>core:true</ext> 【附件文档】附件文档 【传参】 1、支持的文件格式：doc，docx，xls，xlsx，txt，pdf，rtf，jpg，png，gif，tiff，jpeg，zip，rar，ppt，pptx。 2、单个文件大小上限为10M。
	AttachmentFiles []*os.File `json:"attachmentFiles"`
	// <ext>core:true;inner-type:Json<RequestData></ext> 【附件信息】附件信息
	RequestData       string              `json:"requestData"`
	RequestDataObject *common.RequestData `json:"requestDataObject,omitempty"`
}

func (obj DocumentAddcontractattachmentRequest) GetUrl() string {
	return "/document/addcontractattachment"
}

func (obj DocumentAddcontractattachmentRequest) GetHttpParameter() *http.HttpParameter {
	parameter := http.NewPostHttpParameter()
	parameter.AddListFiles("attachmentFiles", obj.AttachmentFiles)
	if obj.RequestDataObject != nil {
		jsonBytes, _ := json.Marshal(obj.RequestDataObject)
		parameter.AddParam("requestData", string(jsonBytes))
	} else {
		parameter.AddParam("requestData", obj.RequestData)
	}
	return parameter
}
