import { ContractLoader, Ipfs, Logger, LoggerOptions, NameResolver, KeyProvider } from '@evan.network/dbcp';
import { CryptoProvider } from './encryption/crypto-provider';
/**
 * mail object
 */
export interface Mail {
    content: {
        attachments?: any[];
        body?: string;
        from?: string;
        fromAlias?: string;
        fromMail?: string;
        sent?: number;
        title?: string;
        to?: string;
    };
    answers?: MailboxResult;
    parentId?: string;
}
/**
 * collection of mails
 */
export interface MailboxResult {
    mails: {
        [index: string]: Mail;
    };
    totalResultCount: number;
}
/**
 * parameters for Mailbox constructor
 */
export interface MailboxOptions extends LoggerOptions {
    mailboxOwner: string;
    nameResolver: NameResolver;
    ipfs: Ipfs;
    contractLoader: ContractLoader;
    cryptoProvider: CryptoProvider;
    keyProvider: KeyProvider;
    defaultCryptoAlgo: string;
}
/**
 * mailbox helper class for sending and retrieving mails and answers
 *
 * @class      Mailbox (name)
 */
export declare class Mailbox extends Logger {
    mailboxOwner: string;
    nameResolver: NameResolver;
    contractLoader: ContractLoader;
    mailboxContract: any;
    ipfs: Ipfs;
    cryptoProvider: CryptoProvider;
    keyProvider: KeyProvider;
    defaultCryptoAlgo: string;
    initialized: boolean;
    constructor(options: MailboxOptions);
    /**
     * initialize mailbox module
     *
     * @return     {Promise<void>}  resolved when done
     */
    init(): Promise<void>;
    getSentMails(count?: number, offset?: number): Promise<MailboxResult>;
    /**
     * gets received from mailboxOwner
     *
     * @param      {number}                  count   number of mails to retrieve (default 10)
     * @param      {number}                  offset  mail offset (default 0)
     * @return     {Promise<MailboxResult>}  The received mails.
     */
    getReceivedMails(count?: number, offset?: number): Promise<MailboxResult>;
    /**
     * Gets the last n mails, resolved contents
     *
     * @param      {number}        count   retrieve up to this many answers (for paging)
     * @param      {number}        offset  skip this many answers (for paging)
     * @param      {string}        type    retrieve sent or received mails
     * @return     {Promise<any>}  resolved mails
     */
    getMails(count?: number, offset?: number, type?: string): Promise<MailboxResult>;
    /**
     * Gets one single mail directly
     *
     * @param      {string}         mail  mail to resolve (mailId or hash)
     * @return     {Promise<Mail>}  The mail.
     */
    getMail(mail: string): Promise<Mail>;
    /**
     * Gets answer tree for mail, traverses subanswers as well
     *
     * @param      {string}         mailId  mail to resolve
     * @param      {number}         count   retrieve up to this many answers (for paging)
     * @param      {number}         offset  skip this many answers (for paging)
     * @return     {Promise<any>}  answer tree for mail
     */
    getAnswersForMail(mailId: string, count?: number, offset?: number): Promise<any>;
    /**
     * sends a mail to given target
     *
     * @param      {Mail}           mail     a mail to send
     * @param      {string}         from     account id to send mail from
     * @param      {string}         to       account id to send mail to
     * @param      {string}         value    (optional) UTC amount to send with mail in Wei can be
     *                                       created with web3[.utils].toWei(...)
     * @param      {string}         context  encrypt mail with different context
     * @return     {Promise<void>}  resolved when done
     */
    sendMail(mail: Mail, from: string, to: string, value?: string, context?: string): Promise<void>;
    /**
     * send answer to a mail
     *
     * @param      {Mail}           mail    mail to send as a reply
     * @param      {string}         from    sender address
     * @param      {string}         to      receiver address
     * @param      {string}         value   (optional) UTC amount to send with mail in Wei can be
     *                                       created with web3[.utils].toWei(...)
     * @return     {Promise<void>}  resolved when done
     */
    sendAnswer(mail: Mail, from: string, to: string, value?: string): Promise<void>;
    /**
     * returns amount of UTC deposited for a mail
     *
     * @param      {string}           mailId  mail to resolve
     * @return     {Promise<string>}  balance of the mail in Wei  can be converted with
     *                                web3[.utils].fromWei(...)
     */
    getBalanceFromMail(mailId: string): Promise<string>;
    /**
     * transfers mails deposited UTC tokens to target account
     *
     * @param      {string}         mailId     mail to resolve
     * @param      {string}         recipient  account, that receives the EVEs
     * @return     {Promise<void>}  resolved when done
     */
    withdrawFromMail(mailId: string, recipient: string): Promise<void>;
}
