# This file is part of Tradon. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.

from trytond.model import ModelSQL, ModelView, fields

__all__ = ['ValuationMethod', 'HaircutFormula', 'CollateralType']


class ValuationMethod(ModelSQL, ModelView):
    'Valuation Method'
    __name__ = 'trade_finance.valuation_method'
    _rec_name = 'name'

    code = fields.Char('Code', required=True)
    name = fields.Char('Name', required=True)
    description = fields.Text('Description')
    active = fields.Boolean('Active')

    @staticmethod
    def default_active():
        return True


class HaircutFormula(ModelSQL, ModelView):
    'Haircut Formula'
    __name__ = 'trade_finance.haircut_formula'
    _rec_name = 'name'

    code = fields.Char('Code', required=True)
    name = fields.Char('Name', required=True)
    description = fields.Text('Description')
    active = fields.Boolean('Active')

    @staticmethod
    def default_active():
        return True


class CollateralType(ModelSQL, ModelView):
    'Collateral Type'
    __name__ = 'trade_finance.collateral_type'
    _rec_name = 'name'

    code = fields.Char('Code', required=True)
    name = fields.Char('Name', required=True)
    active = fields.Boolean('Active')

    @staticmethod
    def default_active():
        return True
