#ifndef EPP_CONTACT_IDL
#define EPP_CONTACT_IDL

#include "epp.idl"

/*
** EPP-RTK IDL
**
** Authors: 
**      Daniel Manley (Tucows Inc)
**      Asbjorn Steira Mikkelsen (The Global Name Registry, Limited)
**      Frank Thompson (Tucows Inc)
**
** $Header: /cvsroot/epp-rtk/epp-rtk/idl/0604/epp_contact.idl,v 1.1 2003/03/21 16:04:54 tubadanm Exp $
** $Revision: 1.1 $
** $Date: 2003/03/21 16:04:54 $
*/

module contact
{
    ///////////////////////////
    //  common enumerations  //
    ///////////////////////////
    enum epp_ContactStatusType
    { 
        CLIENT_DELETE_PROHIBITED,
        SERVER_DELETE_PROHIBITED,
        CLIENT_TRANSFER_PROHIBITED,
        SERVER_TRANSFER_PROHIBITED,
        CLIENT_UPDATE_PROHIBITED,
        SERVER_UPDATE_PROHIBITED,
        LINKED,
        OK,
        PENDING_DELETE,
        PENDING_TRANSFER
    };

    struct epp_ContactStatus
    {
        epp_ContactStatusType m_type;
        epp::epp_string m_lang;
        epp::epp_string m_value;
    };
    
    typedef sequence<epp_ContactStatus> epp_contact_status_seq;

    //////////////////////////////////////
    //  common contact data structures  //
    //////////////////////////////////////
    struct epp_ContactAddress
    {
        epp::epp_string m_street1;
        epp::epp_string m_street2;
        epp::epp_string m_street3;
        epp::epp_string m_city;
        epp::epp_string m_state_province;
        epp::epp_string m_postal_code;
        epp::epp_string m_country_code;
    };

    struct epp_ContactNameAddress
    {
        epp::epp_string m_name;
        epp::epp_string m_org;
        epp_ContactAddress m_address;
    };

    typedef sequence<epp_ContactNameAddress> epp_contact_name_address_seq;

    // used for both m_voice and m_fax data members
    struct epp_ContactPhone
    {
        epp::epp_string m_extension;
        epp::epp_string m_value;
    };

    ////////////////////
    //  contact:info  // 
    ////////////////////
    struct epp_ContactInfoReq
    {
        epp::epp_Command m_cmd;
        epp::epp_string m_id;
    };

    struct epp_ContactInfoRsp
    {
        epp::epp_Response m_rsp;
        epp::epp_string m_id;
        epp::epp_roid m_roid;
        epp_contact_name_address_seq m_addresses;
        epp_ContactPhone m_voice;
        epp_ContactPhone m_fax;
        epp::epp_string m_email;
        epp_contact_status_seq m_status;

        epp::epp_string m_client_id;
        epp::epp_string m_created_by;
        epp::epp_datetime m_created_date;
        epp::epp_string m_updated_by;
        epp::epp_datetime m_updated_date;
        epp::epp_datetime m_transfer_date;
        epp::epp_AuthInfo m_auth_info;
    };

    interface epp_ContactInfo : epp::epp_Action
    {
        void setRequestData(in epp_ContactInfoReq parms);
        epp_ContactInfoRsp getResponseData();
    };

    /////////////////////
    //  contact:check  //
    /////////////////////
    struct epp_ContactCheckReq
    {
        epp::epp_Command m_cmd;
        epp::epp_string_seq m_ids;
    };

    struct epp_ContactCheckRsp
    {
        epp::epp_Response m_rsp;
        epp::epp_check_result_seq m_results;
    };

    interface epp_ContactCheck : epp::epp_Action
    {
        void setRequestData(in epp_ContactCheckReq parms);
        epp_ContactCheckRsp getResponseData();
    };

    //////////////////////
    //  contact:create  // 
    //////////////////////
    struct epp_ContactCreateReq
    {
        epp::epp_Command m_cmd;
        epp::epp_string m_id;
        epp_contact_name_address_seq m_addresses;
        epp_ContactPhone m_voice;
        epp_ContactPhone m_fax;
        epp::epp_string m_email;
        epp::epp_AuthInfo m_auth_info;
    };

    struct epp_ContactCreateRsp
    {
        epp::epp_Response m_rsp;
        epp::epp_string m_id;
        epp::epp_datetime m_creation_date;
    };

    interface epp_ContactCreate : epp::epp_Action
    {
        void setRequestData(in epp_ContactCreateReq parms);
        epp_ContactCreateRsp getResponseData();
    };

    //////////////////////
    //  contact:delete  //
    //////////////////////
    struct epp_ContactDeleteReq
    {
        epp::epp_Command m_cmd;
        epp::epp_string m_id;
    };

    struct epp_ContactDeleteRsp
    {
        epp::epp_Response m_rsp;
    };

    interface epp_ContactDelete : epp::epp_Action
    {
        void setRequestData(in epp_ContactDeleteReq parms);
        epp_ContactDeleteRsp getResponseData();
    };

    ////////////////////////
    //  contact:transfer  //
    ////////////////////////
    struct epp_ContactTransferReq
    {
        epp::epp_Command m_cmd;
        epp::epp_TransferRequest m_trans;
        epp::epp_string m_id;
    };

    // dual purpose struct and interface.
    // when used as the response to a transfer 
    // command, it's a plain struct/classs.  When 
    // used in the response to the poll command, then the 
    // symantic usage of the class is as an interface...
    // The value from getType() in the superinterface
    // tell the RTK user what type of poll response this
    // is so that the proper data is extracted.
    interface epp_ContactTrnData : epp::epp_PollResData
    {
        // The value of this const is to be returned in
        // the call to getType() defined in epp_PollResData
        const epp::epp_string m_type = "contact:trnData";
        
        attribute epp::epp_string m_id;
        attribute epp::epp_TransferStatusType m_transfer_status;
        attribute epp::epp_string m_request_client_id;
        attribute epp::epp_datetime m_request_date;
        attribute epp::epp_string m_action_client_id;
        attribute epp::epp_datetime m_action_date;
    }; 

    struct epp_ContactTransferRsp
    {
        epp::epp_Response m_rsp;
        epp_ContactTrnData m_trn_data;
    };

    interface epp_ContactTransfer : epp::epp_Action
    {
        void setRequestData(in epp_ContactTransferReq parms);
        epp_ContactTransferRsp getResponseData();
    };

    //////////////////////
    //  contact:update  //
    //////////////////////
    struct epp_ContactUpdateAddRemove
    {
        epp_contact_status_seq m_status;
    };

    struct epp_ContactUpdateChange
    {
        epp_contact_name_address_seq m_addresses;
        epp_ContactPhone m_voice;
        epp_ContactPhone m_fax;
        epp::epp_string m_email;
        epp::epp_AuthInfo m_auth_info;
    };
    
    struct epp_ContactUpdateReq
    {
        epp::epp_Command m_cmd;
        epp::epp_string m_id;
        epp_ContactUpdateAddRemove m_add;
        epp_ContactUpdateAddRemove m_remove;
        epp_ContactUpdateChange m_change;
    };

    struct epp_ContactUpdateRsp
    {
        epp::epp_Response m_rsp;
    };

    interface epp_ContactUpdate : epp::epp_Action
    {
        void setRequestData(in epp_ContactUpdateReq parms);
        epp_ContactUpdateRsp getResponseData();
    };
};

#endif
