# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)

from odoo import models, fields


class FusionSyncLog(models.Model):
    _name = 'fusion.sync.log'
    _description = 'Inventory Sync Log'
    _order = 'create_date desc'
    _rec_name = 'summary'

    config_id = fields.Many2one('fusion.sync.config', string='Sync Config',
                                required=True, ondelete='cascade')
    direction = fields.Selection([
        ('pull', 'Pull (Remote -> Local)'),
        ('push', 'Push (Local -> Remote)'),
    ], string='Direction', required=True)
    sync_type = fields.Selection([
        ('product', 'Product Catalog'),
        ('stock', 'Stock Levels'),
        ('full', 'Full Sync'),
    ], string='Type', required=True)
    status = fields.Selection([
        ('success', 'Success'),
        ('partial', 'Partial'),
        ('error', 'Error'),
    ], string='Status', required=True)
    summary = fields.Char(string='Summary')
    details = fields.Text(string='Details')
    product_count = fields.Integer(string='Products Affected')
