<?php
/**
 * Created by PhpStorm.
 * User: antonpauli
 * Date: 27.11.13
 * Time: 15:44
 */

class HistoryCell
{
    public static function directionIcon($model)
    {
        // skip voicemails
        if ($model->voicemail_id != null) {
            return false;
        }

        if ($model->typ == UCType::Callrecording) {
            return false;
        }

        if ($model->state == UCState::Forwarded) {
            return '<i class="icon-share-alt direction"></i>';
        }

        switch ($model->direction) {
            case UCDirection::In:
                return '<i class="icon-arrow-down direction"></i>';
            case UCDirection::Out:
                return '<i class="icon-arrow-up direction"></i>';
            default:
                return false;
        }
    }


    public static function typeIcon($model)
    {
        switch ($model->typ) {
            case UCType::Fax:
                return '<i class="icon-print icon-large"></i>';
            case UCType::Call:
                if ($model->voicemail_id != null) {
                    return '<i class="icon-volume-up"></i>';
                }
                return '<i class="icon-phone icon-2x"></i>';
            case UCType::Email:
                return '<i class="icon-envelope"></i>';
            case UCType::Callrecording:
                return '<i class="icon-microphone"></i>';
            default:
                return false;
        }
    }

    public static function classForCallState($model) {

        switch ($model->state) {
            case UCState::Ringing:
            case UCState::Answered:
                return 'activeCall';
            case UCState::Forwarded:
                return 'forwardedCall';
            case UCState::Picked:
                return 'pickedCall';
            case UCState::Blindtransfered:
            case UCState::Attendedtransfered:
            case UCState::Missed:
                return 'missedCall';
            case UCState::Success:
                return 'successCall';
            default:
                return '';
        }
    }
}
