<?php

/**
 * This class is used to interface with your API so that the plugin
 * can get and set the Spam Settings.
 *
 */ 
 
class Api
{
    /**
     * This is the email account name for which we need to get/set data
     */
    private $_emailAccount;


    public function __construct($emailAccount)
    {
        $this->_emailAccount = $emailAccount;
        
        // Do any further API connection/authentication if required
    }
    
    
    /**
     * This method should fetch the Spam Settings and return it as
     * an array as such:
     *
     * array(
     *  'whitelist_from' => "" // (string) list of email addresses, one per line 
     *  'blacklsit_from' => "" // (string) list of email addresses, one per line
     *  'required_score' => "" // (string|int) numerical value for the required_score 
     *  'spam_treatment' => "" // (string) a value of either "mark", "trash" or "delete"
     *  'rewrite_header' => "" // (string)
     * )
     *
     * The user for whom you need to get the settings is in $this->_emailAccount
     *
     * @return Array
     */ 
    public function getSpamSettings()
    {
        
    }
    
    
    /**
     * This method is used to save the Spam Settings, so you need to use your API to set
     * the data passed to this method.
     *
     * @param array  $whitelist An array of email addresses to be whitelisted
     * @param array  $blacklist An array of email addresses to be blacklisted
     * @param string $requiredScore The score required to mark an email as spam
     * @param string $spamTreatment What to do if an email is marked as spam (mark, delete or trash)
     * @param string $rewriteHeader What tag to add to the subject header if an email is spam
     * @return bool|string Return boolean TRUE on success or an error message on failure
     */     
    public function saveSpamSettings($whitelist, $blacklist, $requiredScore, $spamTreatment, $rewriteHeader)
    {
        // Use your API to save the spam settings
        
    }
    
}

