# Task Team Connector — Sync log
from odoo import fields, models


class TaskTeamSyncLog(models.Model):
    _name = 'task.team.sync.log'
    _description = 'Task Team Sync Log'
    _order = 'create_date desc'
    _rec_name = 'create_date'

    task_id = fields.Integer(string='Odoo Task ID', index=True)
    tt_task_id = fields.Char(string='Task Team ID', index=True)
    direction = fields.Selection(
        [
            ('outbound', 'Outbound  (Odoo → Task Team)'),
            ('inbound', 'Inbound  (Task Team → Odoo)'),
        ],
        required=True,
        string='Direction',
    )
    status = fields.Selection(
        [('success', 'Success'), ('error', 'Error')],
        required=True,
        string='Status',
    )
    payload = fields.Text(string='Payload')
    error_message = fields.Text(string='Error Message')
    create_date = fields.Datetime(string='Timestamp', readonly=True)
