package model

import "security-center-backend/internal/service/directory"

type AuditLog struct {
	Base
	UserID        *uint64             `json:"user_id"`
	ActorType     string              `gorm:"size:50;not null;default:'user'" json:"actor_type"`
	ActorUserID   *uint64             `gorm:"index" json:"actor_user_id,omitempty"`
	ActorEmail    string              `gorm:"size:320;index" json:"actor_email"`
	ActorUser     *User               `gorm:"foreignKey:ActorUserID" json:"actor_user,omitempty"`
	ActorEmployee *directory.Employee `gorm:"-" json:"actor_employee,omitempty"`
	Action        string              `gorm:"size:150;not null" json:"action"`
	ResourceType  string              `gorm:"size:120;not null" json:"resource_type"`
	ResourceID    string              `gorm:"size:255" json:"resource_id"`
	Metadata      JSONB               `gorm:"type:json" json:"metadata"`
	BeforeState   JSONB               `gorm:"type:json" json:"before_state"`
	AfterState    JSONB               `gorm:"type:json" json:"after_state"`
	IPAddress     string              `gorm:"size:64" json:"ip_address"`
	UserAgent     string              `gorm:"size:255" json:"user_agent"`
}
