package model

import (
	"encoding/json"
	"time"
)

type WafLog struct {
	Id         int    `json:"id" form:"id" gorm:"column:id;primary_key;AUTO_INCREMENT;not null"`
	Uid        int    `json:"uid" form:"uid" gorm:"column:uid;default:0;not null"`
	Name       string `json:"name" form:"name" gorm:"column:name"`
	RequestIp  string `json:"requestIp" form:"requestIp" gorm:"column:request_ip"`
	RuleId     int    `json:"ruleId" form:"ruleId" gorm:"column:rule_id;default:0"`
	HostId     int    `json:"hostId" form:"hostId" gorm:"column:host_id;default:0"`
	UserAgent  string `json:"userAgent" form:"userAgent" gorm:"column:user_agent"`
	Api        string `json:"api" form:"api" gorm:"column:api"`
	ApiName    string `json:"apiName" form:"apiName" gorm:"column:api_name"`
	ApiType    string `json:"apiType" form:"apiType" gorm:"column:api_type"`
	ExtraData  json.RawMessage `json:"extraData" form:"extraData" gorm:"column:extra_data"`
	CreatedAt  time.Time `json:"createdAt" form:"createdAt" gorm:"column:created_at"`
	UpdatedAt  time.Time `json:"updatedAt" form:"updatedAt" gorm:"column:updated_at"`
}

func (m *WafLog) TableName() string {
    return "waf_log"
}
