<?php

require_once 'application/models/inbox.php';

class Inbox_ImapFolderController extends Inbox_Controller_Base
{
    public function init()
    {
        parent::init();
    }

    public function indexAction()
    {
        $this->methodNotAllowed();
    }

    public function getAction()
    {
        $id = $this->_getParam('id', 0);

        if($id <= 0)
        {
            $this->preconditionFailed();
            return;
        }

        try
        {
            $inbox = new inbox();
            $iMapFolders = $inbox->getImapFolders($id);

            $this->renderJson($iMapFolders);
        }
        catch (Exception $e)
        {
            $this->renderJson(array('error' => array('text' => $e->getMessage())));
        }
    }

    public function postAction()
    {
        $this->methodNotAllowed();
    }

    public function putAction()
    {
        $this->methodNotAllowed();
    }

    public function deleteAction()
    {
        $this->methodNotAllowed();
    }
}
