// Copyright (c) 2017-2025 Tencent. All Rights Reserved.
//
// 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.

package v20180416

import (
    tcerr "github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/errors"
    tchttp "github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/http"
    "github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/json"
)

// Predefined struct for user
type DescribeFabricBlockRequestParams struct {
	// Cluster ID, which can be obtained from the blockchain cluster details or in the list.
	ClusterId *string `json:"ClusterId,omitnil,omitempty" name:"ClusterId"`

	// Channel ID, which can be obtained from the channel list or channel detail.
	ChannelId *string `json:"ChannelId,omitnil,omitempty" name:"ChannelId"`

	// Block height, starting from 0.
	BlockHeight *int64 `json:"BlockHeight,omitnil,omitempty" name:"BlockHeight"`
}

type DescribeFabricBlockRequest struct {
	*tchttp.BaseRequest
	
	// Cluster ID, which can be obtained from the blockchain cluster details or in the list.
	ClusterId *string `json:"ClusterId,omitnil,omitempty" name:"ClusterId"`

	// Channel ID, which can be obtained from the channel list or channel detail.
	ChannelId *string `json:"ChannelId,omitnil,omitempty" name:"ChannelId"`

	// Block height, starting from 0.
	BlockHeight *int64 `json:"BlockHeight,omitnil,omitempty" name:"BlockHeight"`
}

func (r *DescribeFabricBlockRequest) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *DescribeFabricBlockRequest) FromJsonString(s string) error {
	f := make(map[string]interface{})
	if err := json.Unmarshal([]byte(s), &f); err != nil {
		return err
	}
	delete(f, "ClusterId")
	delete(f, "ChannelId")
	delete(f, "BlockHeight")
	if len(f) > 0 {
		return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeFabricBlockRequest has unknown keys!", "")
	}
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type DescribeFabricBlockResponseParams struct {
	// Block height.
	BlockHeight *int64 `json:"BlockHeight,omitnil,omitempty" name:"BlockHeight"`

	// Block Hash.
	BlockHash *string `json:"BlockHash,omitnil,omitempty" name:"BlockHash"`

	// Pre-Block Hash.
	PreBlockHash *string `json:"PreBlockHash,omitnil,omitempty" name:"PreBlockHash"`

	// The number of transactions in a block.
	TxCount *int64 `json:"TxCount,omitnil,omitempty" name:"TxCount"`

	// Transaction list in the block.
	TransactionList []*Transaction `json:"TransactionList,omitnil,omitempty" name:"TransactionList"`

	// Creation Timestamp
	CreateTimestamp *string `json:"CreateTimestamp,omitnil,omitempty" name:"CreateTimestamp"`

	// Proposal organization.
	ProposerOrg *string `json:"ProposerOrg,omitnil,omitempty" name:"ProposerOrg"`

	// The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
	RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
}

type DescribeFabricBlockResponse struct {
	*tchttp.BaseResponse
	Response *DescribeFabricBlockResponseParams `json:"Response"`
}

func (r *DescribeFabricBlockResponse) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *DescribeFabricBlockResponse) FromJsonString(s string) error {
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type DescribeFabricTransactionRequestParams struct {
	// Cluster ID, which can be obtained from the blockchain cluster details or in the list.
	ClusterId *string `json:"ClusterId,omitnil,omitempty" name:"ClusterId"`

	// Channel ID, which can be obtained from the channel list or channel detail.
	ChannelId *string `json:"ChannelId,omitnil,omitempty" name:"ChannelId"`

	// Transaction ID
	TxId *string `json:"TxId,omitnil,omitempty" name:"TxId"`
}

type DescribeFabricTransactionRequest struct {
	*tchttp.BaseRequest
	
	// Cluster ID, which can be obtained from the blockchain cluster details or in the list.
	ClusterId *string `json:"ClusterId,omitnil,omitempty" name:"ClusterId"`

	// Channel ID, which can be obtained from the channel list or channel detail.
	ChannelId *string `json:"ChannelId,omitnil,omitempty" name:"ChannelId"`

	// Transaction ID
	TxId *string `json:"TxId,omitnil,omitempty" name:"TxId"`
}

func (r *DescribeFabricTransactionRequest) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *DescribeFabricTransactionRequest) FromJsonString(s string) error {
	f := make(map[string]interface{})
	if err := json.Unmarshal([]byte(s), &f); err != nil {
		return err
	}
	delete(f, "ClusterId")
	delete(f, "ChannelId")
	delete(f, "TxId")
	if len(f) > 0 {
		return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeFabricTransactionRequest has unknown keys!", "")
	}
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type DescribeFabricTransactionResponseParams struct {
	// Transaction ID
	TxId *string `json:"TxId,omitnil,omitempty" name:"TxId"`

	// Transaction Hash.
	TxHash *string `json:"TxHash,omitnil,omitempty" name:"TxHash"`

	// Transaction status.
	TxStatus *string `json:"TxStatus,omitnil,omitempty" name:"TxStatus"`

	// Organization list involved.
	JoinOrgList []*string `json:"JoinOrgList,omitnil,omitempty" name:"JoinOrgList"`

	// Transaction sender.
	Sender *string `json:"Sender,omitnil,omitempty" name:"Sender"`

	// Creation time
	CreateTime *string `json:"CreateTime,omitnil,omitempty" name:"CreateTime"`

	// Block height.
	BlockHeight *int64 `json:"BlockHeight,omitnil,omitempty" name:"BlockHeight"`

	// The contract to which the exchange belongs.
	ChaincodeName *string `json:"ChaincodeName,omitnil,omitempty" name:"ChaincodeName"`

	// Transaction data, base64 encoded, decoded as a json string.
	TransactionData *string `json:"TransactionData,omitnil,omitempty" name:"TransactionData"`

	// The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
	RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
}

type DescribeFabricTransactionResponse struct {
	*tchttp.BaseResponse
	Response *DescribeFabricTransactionResponseParams `json:"Response"`
}

func (r *DescribeFabricTransactionResponse) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *DescribeFabricTransactionResponse) FromJsonString(s string) error {
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type InvokeFabricChaincodeRequestParams struct {
	// Cluster ID, which can be obtained from the blockchain cluster details.
	ClusterId *string `json:"ClusterId,omitnil,omitempty" name:"ClusterId"`

	// Channel ID, which can be obtained from the channel list or channel detail.
	ChannelId *string `json:"ChannelId,omitnil,omitempty" name:"ChannelId"`

	// Contract name. it can be obtained from the contract list or contract details.
	ChaincodeName *string `json:"ChaincodeName,omitnil,omitempty" name:"ChaincodeName"`

	// Contract method.
	FuncName *string `json:"FuncName,omitnil,omitempty" name:"FuncName"`

	// Contract method input parameter.
	FuncParam []*string `json:"FuncParam,omitnil,omitempty" name:"FuncParam"`

	// Whether to execute asynchronously. if so, use the transaction TxID in the return value to query the execution result.
	WithAsyncResult *bool `json:"WithAsyncResult,omitnil,omitempty" name:"WithAsyncResult"`
}

type InvokeFabricChaincodeRequest struct {
	*tchttp.BaseRequest
	
	// Cluster ID, which can be obtained from the blockchain cluster details.
	ClusterId *string `json:"ClusterId,omitnil,omitempty" name:"ClusterId"`

	// Channel ID, which can be obtained from the channel list or channel detail.
	ChannelId *string `json:"ChannelId,omitnil,omitempty" name:"ChannelId"`

	// Contract name. it can be obtained from the contract list or contract details.
	ChaincodeName *string `json:"ChaincodeName,omitnil,omitempty" name:"ChaincodeName"`

	// Contract method.
	FuncName *string `json:"FuncName,omitnil,omitempty" name:"FuncName"`

	// Contract method input parameter.
	FuncParam []*string `json:"FuncParam,omitnil,omitempty" name:"FuncParam"`

	// Whether to execute asynchronously. if so, use the transaction TxID in the return value to query the execution result.
	WithAsyncResult *bool `json:"WithAsyncResult,omitnil,omitempty" name:"WithAsyncResult"`
}

func (r *InvokeFabricChaincodeRequest) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *InvokeFabricChaincodeRequest) FromJsonString(s string) error {
	f := make(map[string]interface{})
	if err := json.Unmarshal([]byte(s), &f); err != nil {
		return err
	}
	delete(f, "ClusterId")
	delete(f, "ChannelId")
	delete(f, "ChaincodeName")
	delete(f, "FuncName")
	delete(f, "FuncParam")
	delete(f, "WithAsyncResult")
	if len(f) > 0 {
		return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "InvokeFabricChaincodeRequest has unknown keys!", "")
	}
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type InvokeFabricChaincodeResponseParams struct {
	// Transaction ID
	TxId *string `json:"TxId,omitnil,omitempty" name:"TxId"`

	// Transaction status.
	TxStatus *string `json:"TxStatus,omitnil,omitempty" name:"TxStatus"`

	// Transaction result.
	TxResult *string `json:"TxResult,omitnil,omitempty" name:"TxResult"`

	// The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
	RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
}

type InvokeFabricChaincodeResponse struct {
	*tchttp.BaseResponse
	Response *InvokeFabricChaincodeResponseParams `json:"Response"`
}

func (r *InvokeFabricChaincodeResponse) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *InvokeFabricChaincodeResponse) FromJsonString(s string) error {
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type QueryFabricChaincodeRequestParams struct {
	// Cluster ID, which can be obtained from the blockchain cluster details.
	ClusterId *string `json:"ClusterId,omitnil,omitempty" name:"ClusterId"`

	// Channel ID, which can be obtained from the channel list or channel details.
	ChannelId *string `json:"ChannelId,omitnil,omitempty" name:"ChannelId"`

	// Contract name. it can be obtained from the contract list or contract details.
	ChaincodeName *string `json:"ChaincodeName,omitnil,omitempty" name:"ChaincodeName"`

	// Contract method.
	FuncName *string `json:"FuncName,omitnil,omitempty" name:"FuncName"`

	// Contract method input parameter.
	FuncParam []*string `json:"FuncParam,omitnil,omitempty" name:"FuncParam"`
}

type QueryFabricChaincodeRequest struct {
	*tchttp.BaseRequest
	
	// Cluster ID, which can be obtained from the blockchain cluster details.
	ClusterId *string `json:"ClusterId,omitnil,omitempty" name:"ClusterId"`

	// Channel ID, which can be obtained from the channel list or channel details.
	ChannelId *string `json:"ChannelId,omitnil,omitempty" name:"ChannelId"`

	// Contract name. it can be obtained from the contract list or contract details.
	ChaincodeName *string `json:"ChaincodeName,omitnil,omitempty" name:"ChaincodeName"`

	// Contract method.
	FuncName *string `json:"FuncName,omitnil,omitempty" name:"FuncName"`

	// Contract method input parameter.
	FuncParam []*string `json:"FuncParam,omitnil,omitempty" name:"FuncParam"`
}

func (r *QueryFabricChaincodeRequest) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *QueryFabricChaincodeRequest) FromJsonString(s string) error {
	f := make(map[string]interface{})
	if err := json.Unmarshal([]byte(s), &f); err != nil {
		return err
	}
	delete(f, "ClusterId")
	delete(f, "ChannelId")
	delete(f, "ChaincodeName")
	delete(f, "FuncName")
	delete(f, "FuncParam")
	if len(f) > 0 {
		return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "QueryFabricChaincodeRequest has unknown keys!", "")
	}
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type QueryFabricChaincodeResponseParams struct {
	// Transaction ID
	TxId *string `json:"TxId,omitnil,omitempty" name:"TxId"`

	// Transaction status.
	TxStatus *string `json:"TxStatus,omitnil,omitempty" name:"TxStatus"`

	// Transaction result.
	TxResult *string `json:"TxResult,omitnil,omitempty" name:"TxResult"`

	// The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
	RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
}

type QueryFabricChaincodeResponse struct {
	*tchttp.BaseResponse
	Response *QueryFabricChaincodeResponseParams `json:"Response"`
}

func (r *QueryFabricChaincodeResponse) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *QueryFabricChaincodeResponse) FromJsonString(s string) error {
	return json.Unmarshal([]byte(s), &r)
}

type Transaction struct {
	// Transaction ID
	TxId *string `json:"TxId,omitnil,omitempty" name:"TxId"`

	// Contract name.
	ChaincodeName *string `json:"ChaincodeName,omitnil,omitempty" name:"ChaincodeName"`

	// Transaction sender.
	Sender *string `json:"Sender,omitnil,omitempty" name:"Sender"`

	// Transaction creation time.
	CreateTime *string `json:"CreateTime,omitnil,omitempty" name:"CreateTime"`

	// The block height where the trading platform is located.
	BlockHeight *int64 `json:"BlockHeight,omitnil,omitempty" name:"BlockHeight"`

	// The serial number of a transaction in a block.
	TxIndex *int64 `json:"TxIndex,omitnil,omitempty" name:"TxIndex"`
}