<?php
/**
 * Tax Rates Model
 *
 * @package Sports_Freelancing
 */

class FS_Tax_Rates {
    
    /**
     * Federal self-employment tax rate (SE tax + estimated income tax)
     */
    const FEDERAL_RATE = 15.3;
    
    /**
     * Get state tax rates for all 50 states
     * These are estimated self-employment/business income tax rates
     * 
     * @return array State code => tax rate
     */
    public static function get_state_rates() {
        return array(
            'AL' => 5.0,
            'AK' => 0.0,
            'AZ' => 4.5,
            'AR' => 5.5,
            'CA' => 9.3,
            'CO' => 4.4,
            'CT' => 5.0,
            'DE' => 6.6,
            'FL' => 0.0,
            'GA' => 5.75,
            'HI' => 8.25,
            'ID' => 6.0,
            'IL' => 4.95,
            'IN' => 3.23,
            'IA' => 6.0,
            'KS' => 5.7,
            'KY' => 5.0,
            'LA' => 4.25,
            'ME' => 7.15,
            'MD' => 5.75,
            'MA' => 5.0,
            'MI' => 4.25,
            'MN' => 9.85,
            'MS' => 5.0,
            'MO' => 5.3,
            'MT' => 6.75,
            'NE' => 6.84,
            'NV' => 0.0,
            'NH' => 0.0,
            'NJ' => 10.75,
            'NM' => 5.9,
            'NY' => 6.85,
            'NC' => 4.99,
            'ND' => 2.9,
            'OH' => 3.99,
            'OK' => 5.0,
            'OR' => 9.9,
            'PA' => 3.07,
            'RI' => 5.99,
            'SC' => 7.0,
            'SD' => 0.0,
            'TN' => 0.0,
            'TX' => 0.0,
            'UT' => 4.95,
            'VT' => 8.75,
            'VA' => 5.75,
            'WA' => 0.0,
            'WV' => 6.5,
            'WI' => 7.65,
            'WY' => 0.0
        );
    }
    
    /**
     * Get state names for dropdown
     * 
     * @return array State code => state name
     */
    public static function get_state_names() {
        return array(
            'AL' => 'Alabama',
            'AK' => 'Alaska',
            'AZ' => 'Arizona',
            'AR' => 'Arkansas',
            'CA' => 'California',
            'CO' => 'Colorado',
            'CT' => 'Connecticut',
            'DE' => 'Delaware',
            'FL' => 'Florida',
            'GA' => 'Georgia',
            'HI' => 'Hawaii',
            'ID' => 'Idaho',
            'IL' => 'Illinois',
            'IN' => 'Indiana',
            'IA' => 'Iowa',
            'KS' => 'Kansas',
            'KY' => 'Kentucky',
            'LA' => 'Louisiana',
            'ME' => 'Maine',
            'MD' => 'Maryland',
            'MA' => 'Massachusetts',
            'MI' => 'Michigan',
            'MN' => 'Minnesota',
            'MS' => 'Mississippi',
            'MO' => 'Missouri',
            'MT' => 'Montana',
            'NE' => 'Nebraska',
            'NV' => 'Nevada',
            'NH' => 'New Hampshire',
            'NJ' => 'New Jersey',
            'NM' => 'New Mexico',
            'NY' => 'New York',
            'NC' => 'North Carolina',
            'ND' => 'North Dakota',
            'OH' => 'Ohio',
            'OK' => 'Oklahoma',
            'OR' => 'Oregon',
            'PA' => 'Pennsylvania',
            'RI' => 'Rhode Island',
            'SC' => 'South Carolina',
            'SD' => 'South Dakota',
            'TN' => 'Tennessee',
            'TX' => 'Texas',
            'UT' => 'Utah',
            'VT' => 'Vermont',
            'VA' => 'Virginia',
            'WA' => 'Washington',
            'WV' => 'West Virginia',
            'WI' => 'Wisconsin',
            'WY' => 'Wyoming'
        );
    }
    
    /**
     * Get tax rate for a specific state
     * 
     * @param string $state_code Two-letter state code
     * @return float Tax rate as percentage
     */
    public static function get_state_rate($state_code) {
        $rates = self::get_state_rates();
        return isset($rates[$state_code]) ? $rates[$state_code] : 0.0;
    }
    
    /**
     * Get federal tax rate
     * 
     * @return float Federal tax rate as percentage
     */
    public static function get_federal_rate() {
        return self::FEDERAL_RATE;
    }
    
    /**
     * Get states for dropdown (alias for get_state_names)
     * 
     * @return array State code => state name
     */
    public static function get_states() {
        return self::get_state_names();
    }
}