syntax = "proto3";

package fetch.aea.ContractApi;

message ContractApiMessage{

    // Custom Types
    message Kwargs{
        bytes kwargs = 1;    }

    message RawMessage{
        bytes raw_message = 1;    }

    message RawTransaction{
        bytes raw_transaction = 1;    }

    message State{
        bytes state = 1;    }


    // Performatives and contents
    message Get_Deploy_Transaction_Performative{
        string ledger_id = 1;
        string contract_id = 2;
        string callable = 3;
        Kwargs kwargs = 4;
    }

    message Get_Raw_Transaction_Performative{
        string ledger_id = 1;
        string contract_id = 2;
        string contract_address = 3;
        string callable = 4;
        Kwargs kwargs = 5;
    }

    message Get_Raw_Message_Performative{
        string ledger_id = 1;
        string contract_id = 2;
        string contract_address = 3;
        string callable = 4;
        Kwargs kwargs = 5;
    }

    message Get_State_Performative{
        string ledger_id = 1;
        string contract_id = 2;
        string contract_address = 3;
        string callable = 4;
        Kwargs kwargs = 5;
    }

    message State_Performative{
        State state = 1;
    }

    message Raw_Transaction_Performative{
        RawTransaction raw_transaction = 1;
    }

    message Raw_Message_Performative{
        RawMessage raw_message = 1;
    }

    message Error_Performative{
        int32 code = 1;
        bool code_is_set = 2;
        string message = 3;
        bool message_is_set = 4;
        bytes data = 5;
    }


    // Standard ContractApiMessage fields
    int32 message_id = 1;
    string dialogue_starter_reference = 2;
    string dialogue_responder_reference = 3;
    int32 target = 4;
    oneof performative{
        Error_Performative error = 5;
        Get_Deploy_Transaction_Performative get_deploy_transaction = 6;
        Get_Raw_Message_Performative get_raw_message = 7;
        Get_Raw_Transaction_Performative get_raw_transaction = 8;
        Get_State_Performative get_state = 9;
        Raw_Message_Performative raw_message = 10;
        Raw_Transaction_Performative raw_transaction = 11;
        State_Performative state = 12;
    }
}
