package pposRequest

import (
	"PPOSUtils/utils"
	"net/url"
)

//NewContestKindInitRequest 赛事类型初始化
func (that *PPOSClient) NewContestKindInitRequest() *ContestKindInitRequest {
	return &ContestKindInitRequest{
		Request: Request{
			Client:     that,
			apiAddress: "/events/contestKind/init",
		},
	}
}

//ContestKindInitRequest
type ContestKindInitRequest struct {
	Request
	CompanyId int64 `json:"company_id"` //公司id
	BusinessId int64 `json:"business_id"` //中心id
}

func (that *ContestKindInitRequest) SetCompanyId(companyId int64) *ContestKindInitRequest {
	that.CompanyId = companyId
	return that
}

func (that *ContestKindInitRequest) SetBusinessId(BusinessId int64) *ContestKindInitRequest {
	that.BusinessId = BusinessId
	return that
}

//Params ...
func (that *ContestKindInitRequest) Params() (url.Values, error) {
	that.initParams()
	_params := that.params
	_params.Set("company_id", utils.ToString(that.CompanyId))
	_params.Set("business_id", utils.ToString(that.BusinessId))
	return _params, nil
}

//Do ...
func (that *ContestKindInitRequest) Do() error {
	//
	 _, _err := that.Client.GetData(that.apiAddress, that)
	if _err != nil {
		return _err
	}
	return nil
}
