package model

import (
	"time"

	"gorm.io/datatypes"
)

type AuditLog struct {
	ID        uint64         `gorm:"primaryKey" json:"id"`
	ActorType string         `gorm:"size:32;not null" json:"actor_type"`
	ActorID   uint64         `gorm:"not null;index" json:"actor_id"`
	Action    string         `gorm:"size:64;not null" json:"action"`
	BizType   string         `gorm:"size:32;not null" json:"biz_type"`
	BizID     *uint64        `json:"biz_id"`
	IP        string         `gorm:"size:64;not null;default:''" json:"ip"`
	UserAgent string         `gorm:"size:512;not null;default:''" json:"user_agent"`
	Detail    datatypes.JSON `json:"detail"`
	CreatedAt time.Time      `json:"created_at"`
}

func (AuditLog) TableName() string {
	return "audit_logs"
}
