<?php

/**
 * Subclass for representing a row from the 'katao_member_deposit' table.
 *
 * @package lib.model
 */
class KataoMemberDeposit extends BaseKataoMemberDeposit {
    const CURRENCY_EURO = 1;
    const CURRENCY_SOL = 2;

    const PAYMENT_MODE_OTHER = 0;
    const PAYMENT_MODE_CASH = 1;
    const PAYMENT_MODE_CHECK = 2;
    const PAYMENT_MODE_BANK_TRANSFER = 3;
    const PAYMENT_MODE_CREDIT = 4;
	const PAYMENT_MODE_WITHDRAWAL = 5;
	const PAYMENT_MODE_TRANSFER_SOL = 6;

    const STATUS_VALIDATED = 1;
    const STATUS_PENDING = 2;
    const STATUS_EXPIRED = 3;

    public function getAmountStr() {
        if (self::CURRENCY_SOL == $this->getCurrency()) {
            return Utils::formatCurrencySol($this->getAmount());
        }
        return Utils::formatCurrencyEuro($this->getAmount());
    }

    public function getCurrencyStr() {
        return KataoMemberDepositPeer::getCurrencyStr($this->getCurrency());
    }

    public function getPaymentModeStr() {
        return KataoMemberDepositPeer::getPaymentModeStr($this->getPaymentMode());
    }

    public function getStatusStr() {
        return KataoMemberDepositPeer::getStatusStr($this->getStatus());
    }

    public function getCreatedAtStr() {
        return CatalyzDate::formatShort($this->getCreatedAt(null));
    }

    public function getValuedAtStr() {
        return CatalyzDate::formatShort($this->getValuedAt(null));
    }

    public function getMemberName() {
        $result = '';
        if (null != $katao_member = $this->getKataoMember()) {
            $result = $katao_member->getFullName();
        }
        return $result;
    }
    public function getMemberLink() {
        $result = '';
        if (null != $katao_member = $this->getKataoMember()) {
            $result = link_to($katao_member->getFullName(), '@katao_member_show?id=' . $katao_member->getId());
        }
        return $result;
    }
}