# -*- coding: utf-8 -*-

from odoo import models, fields, api


class TaxYearlyRates(models.Model):
    _name = 'tax.yearly.rates'
    _description = 'Yearly Tax Rates'
    _order = 'id'

    # === Selection Options ===
    TAX_TYPE_SELECTION = [
        ('federal', 'Federal Taxes'),
        ('provincial', 'Provincial Taxes'),
    ]
    
    DEDUCTION_TYPE_SELECTION = [
        ('cpp', 'Canada Pension Plan'),
        ('ei', 'Employment Insurance'),
    ]

    # === Core Fields ===
    fiscal_year = fields.Many2one(
        'account.fiscal.year',
        string='Fiscal Year',
    )
    tax_type = fields.Selection(
        selection=TAX_TYPE_SELECTION,
        string='Tax Type',
    )
    ded_type = fields.Selection(
        selection=DEDUCTION_TYPE_SELECTION,
        string='Deduction Type',
    )
    
    # === Tax Bracket Lines ===
    tax_yearly_rate_ids = fields.One2many(
        'tax.yearly.rate.line',
        'tax_id',
        string='Tax Lines',
    )

    # === Federal/Provincial Tax Fields ===
    fed_tax_credit = fields.Float(string='Federal Tax Credit')
    provincial_tax_credit = fields.Float(string='Provincial Tax Credit')
    canada_emp_amount = fields.Float(string='Canada Employment Amount')
    exemption = fields.Float(string='Exemption Amount')

    # === CPP (Canada Pension Plan) Fields ===
    cpp_date = fields.Date(string='CPP Date')
    max_cpp = fields.Float(string='Maximum CPP')
    emp_contribution_rate = fields.Float(string='Employee Contribution Rate')
    employer_contribution_rate = fields.Float(string='Employer Contribution Rate')

    # === EI (Employment Insurance) Fields ===
    ei_date = fields.Date(string='EI Date')
    ei_rate = fields.Float(string='EI Rate')
    ei_earnings = fields.Float(string='Maximum EI Earnings')
    emp_ei_amount = fields.Float(string='Employee EI Amount')
    employer_ei_amount = fields.Float(string='Employer EI Amount')
