package smartag

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

import (
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)

// CreateSmartAccessGatewaySoftware invokes the smartag.CreateSmartAccessGatewaySoftware API synchronously
func (client *Client) CreateSmartAccessGatewaySoftware(request *CreateSmartAccessGatewaySoftwareRequest) (response *CreateSmartAccessGatewaySoftwareResponse, err error) {
	response = CreateCreateSmartAccessGatewaySoftwareResponse()
	err = client.DoAction(request, response)
	return
}

// CreateSmartAccessGatewaySoftwareWithChan invokes the smartag.CreateSmartAccessGatewaySoftware API asynchronously
func (client *Client) CreateSmartAccessGatewaySoftwareWithChan(request *CreateSmartAccessGatewaySoftwareRequest) (<-chan *CreateSmartAccessGatewaySoftwareResponse, <-chan error) {
	responseChan := make(chan *CreateSmartAccessGatewaySoftwareResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.CreateSmartAccessGatewaySoftware(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// CreateSmartAccessGatewaySoftwareWithCallback invokes the smartag.CreateSmartAccessGatewaySoftware API asynchronously
func (client *Client) CreateSmartAccessGatewaySoftwareWithCallback(request *CreateSmartAccessGatewaySoftwareRequest, callback func(response *CreateSmartAccessGatewaySoftwareResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *CreateSmartAccessGatewaySoftwareResponse
		var err error
		defer close(result)
		response, err = client.CreateSmartAccessGatewaySoftware(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// CreateSmartAccessGatewaySoftwareRequest is the request struct for api CreateSmartAccessGatewaySoftware
type CreateSmartAccessGatewaySoftwareRequest struct {
	*requests.RpcRequest
	ResourceOwnerId      requests.Integer `position:"Query" name:"ResourceOwnerId"`
	ResourceGroupId      string           `position:"Query" name:"ResourceGroupId"`
	UserCount            requests.Integer `position:"Query" name:"UserCount"`
	Period               requests.Integer `position:"Query" name:"Period"`
	AutoPay              requests.Boolean `position:"Query" name:"AutoPay"`
	ResourceOwnerAccount string           `position:"Query" name:"ResourceOwnerAccount"`
	OwnerAccount         string           `position:"Query" name:"OwnerAccount"`
	OwnerId              requests.Integer `position:"Query" name:"OwnerId"`
	ChargeType           string           `position:"Query" name:"ChargeType"`
	DataPlan             requests.Integer `position:"Query" name:"DataPlan"`
}

// CreateSmartAccessGatewaySoftwareResponse is the response struct for api CreateSmartAccessGatewaySoftware
type CreateSmartAccessGatewaySoftwareResponse struct {
	*responses.BaseResponse
	RequestId       string `json:"RequestId" xml:"RequestId"`
	OrderId         string `json:"OrderId" xml:"OrderId"`
	SmartAGId       string `json:"SmartAGId" xml:"SmartAGId"`
	ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"`
}

// CreateCreateSmartAccessGatewaySoftwareRequest creates a request to invoke CreateSmartAccessGatewaySoftware API
func CreateCreateSmartAccessGatewaySoftwareRequest() (request *CreateSmartAccessGatewaySoftwareRequest) {
	request = &CreateSmartAccessGatewaySoftwareRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("Smartag", "2018-03-13", "CreateSmartAccessGatewaySoftware", "smartag", "openAPI")
	request.Method = requests.POST
	return
}

// CreateCreateSmartAccessGatewaySoftwareResponse creates a response to parse from CreateSmartAccessGatewaySoftware response
func CreateCreateSmartAccessGatewaySoftwareResponse() (response *CreateSmartAccessGatewaySoftwareResponse) {
	response = &CreateSmartAccessGatewaySoftwareResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}
