syntax = "proto3";
package secret.compute.v1beta1;

import "gogoproto/gogo.proto";

option go_package = "github.com/enigmampc/SecretNetwork/x/compute/internal/types";
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.equal_all) = true;

enum AccessType {
    option (gogoproto.goproto_enum_prefix) = false;
    option (gogoproto.goproto_enum_stringer) = false;
    UNDEFINED = 0 [(gogoproto.enumvalue_customname) = "AccessTypeUndefined"];
    NOBODY = 1 [(gogoproto.enumvalue_customname) = "AccessTypeNobody"];
    ONLY_ADDRESS = 2 [(gogoproto.enumvalue_customname) = "AccessTypeOnlyAddress"];
    EVERYBODY = 3 [(gogoproto.enumvalue_customname) = "AccessTypeEverybody"];
}

message AccessTypeParam {
    option (gogoproto.goproto_stringer) = true;
    AccessType value = 1 [(gogoproto.moretags) = "yaml:\"value\""];
}

/*
message AccessConfig {
    option (gogoproto.goproto_stringer) = true;
    AccessType permission = 1 [(gogoproto.moretags) = "yaml:\"permission\""];
    bytes address = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", (gogoproto.moretags) = "yaml:\"address\""];
}
 */

/*
// Params defines the set of wasm parameters.
message Params {
    option (gogoproto.goproto_stringer) = false;
    AccessConfig code_upload_access = 1 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"code_upload_access\""];
    AccessType instantiate_default_permission = 2 [(gogoproto.moretags) = "yaml:\"instantiate_default_permission\""];
}
*/

// CodeInfo is data for the uploaded contract WASM code
message CodeInfo {
    bytes code_hash = 1;
    bytes creator = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
    string source = 3;
    string builder = 4;
//    AccessConfig instantiate_config = 5 [(gogoproto.nullable) = false];
}

message ContractCustomInfo {
    bytes enclave_key = 1 [(gogoproto.customname) = "EnclaveKey"];
    string label = 2;
}

// ContractInfo stores a WASM contract instance
message ContractInfo {
    uint64 code_id = 1 [(gogoproto.customname) = "CodeID"];
    bytes creator = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
//    bytes admin = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
    string label = 4;
    // never show this in query results, just use for sorting
    // (Note: when using json tag "-" amino refused to serialize it...)
    AbsoluteTxPosition created = 5;
    //    bytes init_msg = 5 [(gogoproto.casttype) = "encoding/json.RawMessage"];
    //
    //    AbsoluteTxPosition last_updated = 7;
    //    uint64 previous_code_id = 8 [(gogoproto.customname) = "PreviousCodeID"];
}

/*
enum ContractCodeHistoryOperationType {
    option (gogoproto.goproto_enum_prefix) = false;
    Undefined = 0;
    Init = 1 [(gogoproto.enumvalue_customname) = "ContractCodeHistoryTypeInit"];
    Migrate = 2 [(gogoproto.enumvalue_customname) = "ContractCodeHistoryTypeMigrate"];
    Genesis = 3 [(gogoproto.enumvalue_customname) = "ContractCodeHistoryTypeGenesis"];
}
*/

/*
message ContractHistory {
    repeated ContractCodeHistoryEntry code_history_entries = 1 [(gogoproto.nullable) = false];
}
*/

/*
// ContractCodeHistoryEntry stores code updates to a contract.
message ContractCodeHistoryEntry {
    ContractCodeHistoryOperationType operation = 1;
    uint64 code_id = 2 [(gogoproto.customname) = "CodeID"];
    AbsoluteTxPosition updated = 3;
    bytes msg = 4 [(gogoproto.casttype) = "encoding/json.RawMessage"];

}
*/

// AbsoluteTxPosition can be used to sort contracts
message AbsoluteTxPosition {
    // BlockHeight is the block the contract was created at
    int64 block_height = 1;
    // TxIndex is a monotonic counter within the block (actual transaction index, or gas consumed)
    uint64 tx_index = 2;
}

// Model is a struct that holds a KV pair
message Model {
    // hex-encode key to read it better (this is often ascii)
    bytes Key = 1 [(gogoproto.casttype) = "github.com/tendermint/tendermint/libs/bytes.HexBytes"];
    // base64-encode raw value
    bytes Value = 2;
}