from odoo import fields, models


class WooConflict(models.Model):
    _name = 'woo.conflict'
    _description = 'WooCommerce Sync Conflict'

    instance_id = fields.Many2one('woo.instance', required=True, ondelete='cascade')
    conflict_type = fields.Selection([
        ('product', 'Product'),
        ('customer', 'Customer'),
        ('order', 'Order'),
    ])
    map_id = fields.Many2one('woo.product.map')
    customer_id = fields.Many2one('woo.customer')
    order_id = fields.Many2one('woo.order')
    field_name = fields.Char()
    odoo_value = fields.Char()
    woo_value = fields.Char()
    resolution = fields.Selection([
        ('pending', 'Pending'),
        ('use_odoo', 'Use Odoo'),
        ('use_woo', 'Use WooCommerce'),
    ], default='pending')
    resolved_by = fields.Many2one('res.users')
    company_id = fields.Many2one(
        'res.company', default=lambda self: self.env.company,
    )
