from odoo import models


class HrEmployee(models.Model):
    _name = "hr.employee"
    _inherit = ["hr.employee", "xeno.audit.mixin"]
    # Avatars/images are stored fields but huge and not meaningful as a
    # flat audit diff -- excluded like XENHR excludes file-ish columns.
    _audit_exclude_fields = (
        "avatar_1920", "avatar_1024", "avatar_512", "avatar_256", "avatar_128",
        "image_1920", "image_1024", "image_512", "image_256", "image_128",
    )


class HrVersion(models.Model):
    _name = "hr.version"
    _inherit = ["hr.version", "xeno.audit.mixin"]
    # Odoo 19 moved job_title/wage/contract dates etc. off hr.employee onto
    # this per-version model -- audited here instead, since on hr.employee
    # they're only a non-stored computed passthrough (confirmed directly:
    # an update to job_title showed up as a work_contact_id change on
    # hr.employee and nothing else, until this model was added).


class HrLeave(models.Model):
    _name = "hr.leave"
    _inherit = ["hr.leave", "xeno.audit.mixin"]


class HrLeaveAllocation(models.Model):
    _name = "hr.leave.allocation"
    _inherit = ["hr.leave.allocation", "xeno.audit.mixin"]


class HrLeaveType(models.Model):
    _name = "hr.leave.type"
    _inherit = ["hr.leave.type", "xeno.audit.mixin"]


class XenoLeaveApprover(models.Model):
    _name = "xeno.leave.approver"
    _inherit = ["xeno.leave.approver", "xeno.audit.mixin"]


class XenoResignation(models.Model):
    _name = "xeno.resignation"
    _inherit = ["xeno.resignation", "xeno.audit.mixin"]
    _audit_exclude_fields = ("attachment",)


class XenoAttendanceOverride(models.Model):
    _name = "xeno.attendance.override"
    _inherit = ["xeno.attendance.override", "xeno.audit.mixin"]


class XenoAttendanceCodeMap(models.Model):
    _name = "xeno.attendance.code.map"
    _inherit = ["xeno.attendance.code.map", "xeno.audit.mixin"]
    # A remap silently redirects a scanner code's punches to another
    # employee -- exactly the kind of quiet data rerouting audit is for.


class XenoAttendanceViewer(models.Model):
    _name = "xeno.attendance.viewer"
    _inherit = ["xeno.attendance.viewer", "xeno.audit.mixin"]
    # Grants a user visibility of someone's attendance under My Team --
    # an access-control change, so log who granted/revoked it.


class XenoHrAnnouncement(models.Model):
    _name = "xeno.hr.announcement"
    _inherit = ["xeno.hr.announcement", "xeno.audit.mixin"]
    # Company-wide announcement shown on every employee's Home dashboard --
    # worth knowing who posted/edited/removed one, same as any other
    # company-wide broadcast in this module.
