from odoo import models, fields


class FusionTrackingEvent(models.Model):
    _name = 'fusion.tracking.event'
    _description = 'Shipping Tracking Event'
    _order = 'event_datetime desc, id desc'
    _rec_name = 'event_description'

    shipment_id = fields.Many2one(
        'fusion.shipment',
        string='Shipment',
        required=True,
        ondelete='cascade',
        index=True,
    )
    event_date = fields.Date(
        string='Event Date',
    )
    event_time = fields.Char(
        string='Event Time',
        help='Time from Canada Post (HH:MM:SS)',
    )
    event_datetime = fields.Datetime(
        string='Date/Time',
        help='Combined date and time for sorting',
    )
    event_description = fields.Char(
        string='Description',
    )
    event_type = fields.Char(
        string='Event Type',
        help='Canada Post event type code',
    )
    event_site = fields.Char(
        string='Location',
    )
    event_province = fields.Char(
        string='Province',
    )
    signatory_name = fields.Char(
        string='Signatory',
        help='Name of person who signed for delivery',
    )
