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

from odoo import api, fields, models, _


class WheelchairConfigFlowConnection(models.Model):
    _name = 'fusion.wc.config.flow.connection'
    _description = 'Configuration Flow Connection'
    _order = 'sequence, id'

    flow_id = fields.Many2one('fusion.wc.config.flow', string='Flow',
        required=True, ondelete='cascade', index=True)

    source_node_id = fields.Many2one('fusion.wc.config.flow.node',
        string='Source Node', required=True, ondelete='cascade', index=True)
    target_node_id = fields.Many2one('fusion.wc.config.flow.node',
        string='Target Node', required=True, ondelete='cascade', index=True)

    source_port = fields.Char(string='Source Port', default='out',
        help='Port key: out, true, false, or option port_key')

    label = fields.Char(string='Label',
        help='Text shown on the connection line')

    condition_json = fields.Text(string='Condition', default='{}',
        help='Optional condition as JSON for advanced routing')

    sequence = fields.Integer(default=10)
