# 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__ = ['FinancingType', 'OperationalStatus']


class FinancingType(ModelSQL, ModelView):
    'Financing Type'
    __name__ = 'trade_finance.financing_type'
    _rec_name = 'name'

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

    @staticmethod
    def default_active():
        return True

    @staticmethod
    def default_sequence():
        return 10


class OperationalStatus(ModelSQL, ModelView):
    'Operational Status'
    __name__ = 'trade_finance.operational_status'
    _rec_name = 'name'

    code = fields.Char('Code', required=True)
    name = fields.Char('Name', required=True)
    financing_type = fields.Many2One(
        'trade_finance.financing_type', 'Default Financing Type',
        ondelete='RESTRICT')
    sequence = fields.Integer('Sequence')
    active = fields.Boolean('Active')

    @staticmethod
    def default_active():
        return True

    @staticmethod
    def default_sequence():
        return 10
