package domain

import "time"

const TableNameActivityLogConst = "activity_log"

type ActivityLog struct {
	ID          string     `gorm:"column:id;type:character(26);primaryKey;default:generate_ulid()" json:"id"`
	TargetTable string     `gorm:"column:table_name;type:character varying(100);not null" json:"table_name"`
	RecordID    string     `gorm:"column:record_id;type:character(26);not null" json:"record_id"`
	Action      string     `gorm:"column:action;type:character varying(20);not null" json:"action"`
	OldData     *string    `gorm:"column:old_data;type:jsonb" json:"old_data"`
	NewData     *string    `gorm:"column:new_data;type:jsonb" json:"new_data"`
	CascadeData *string    `gorm:"column:cascade_data;type:jsonb" json:"cascade_data"`
	UserID      string     `gorm:"column:user_id;type:character(26);not null" json:"user_id"`
	UserName    string     `gorm:"column:user_name;type:character varying(255);not null" json:"user_name"`
	MerchantID  *string    `gorm:"column:merchant_id;type:character(26)" json:"merchant_id"`
	CreatedOn   *time.Time `gorm:"column:created_on;type:timestamp without time zone;default:now()" json:"created_on"`
}

func (*ActivityLog) TableName() string {
	return TableNameActivityLogConst
}
