package models

import "odoo-go/pkg/orm"

// initIrLogging registers ir.logging — Server-side log entries.
// Mirrors: odoo/addons/base/models/ir_logging.py class IrLogging
//
// Stores structured log entries written by the server,
// accessible via Settings > Technical > Logging.
func initIrLogging() {
	m := orm.NewModel("ir.logging", orm.ModelOpts{
		Description: "Logging",
		Order:       "id desc",
	})

	m.AddFields(
		orm.Char("name", orm.FieldOpts{String: "Name", Required: true}),
		orm.Selection("type", []orm.SelectionItem{
			{Value: "client", Label: "Client"},
			{Value: "server", Label: "Server"},
		}, orm.FieldOpts{String: "Type", Required: true}),
		orm.Char("dbname", orm.FieldOpts{String: "Database Name"}),
		orm.Selection("level", []orm.SelectionItem{
			{Value: "DEBUG", Label: "Debug"},
			{Value: "INFO", Label: "Info"},
			{Value: "WARNING", Label: "Warning"},
			{Value: "ERROR", Label: "Error"},
			{Value: "CRITICAL", Label: "Critical"},
		}, orm.FieldOpts{String: "Level"}),
		orm.Text("message", orm.FieldOpts{String: "Message", Required: true}),
		orm.Char("path", orm.FieldOpts{String: "Path"}),
		orm.Char("func", orm.FieldOpts{String: "Function"}),
		orm.Char("line", orm.FieldOpts{String: "Line"}),
	)
}
