package models

import "odoo-go/pkg/orm"

// initHrContract registers the hr.contract model.
// Mirrors: odoo/addons/hr_contract/models/hr_contract.py
func initHrContract() {
	m := orm.NewModel("hr.contract", orm.ModelOpts{
		Description: "Employee Contract",
		Order:       "date_start desc",
	})

	m.AddFields(
		orm.Char("name", orm.FieldOpts{String: "Contract Reference", Required: true}),
		orm.Many2one("employee_id", "hr.employee", orm.FieldOpts{String: "Employee", Required: true}),
		orm.Many2one("department_id", "hr.department", orm.FieldOpts{String: "Department"}),
		orm.Many2one("job_id", "hr.job", orm.FieldOpts{String: "Job Position"}),
		orm.Date("date_start", orm.FieldOpts{String: "Start Date", Required: true}),
		orm.Date("date_end", orm.FieldOpts{String: "End Date"}),
		orm.Monetary("wage", orm.FieldOpts{String: "Wage", Required: true, CurrencyField: "currency_id"}),
		orm.Many2one("currency_id", "res.currency", orm.FieldOpts{String: "Currency"}),
		orm.Selection("state", []orm.SelectionItem{
			{Value: "draft", Label: "New"},
			{Value: "open", Label: "Running"},
			{Value: "close", Label: "Expired"},
			{Value: "cancel", Label: "Cancelled"},
		}, orm.FieldOpts{String: "Status", Default: "draft"}),
		orm.Many2one("company_id", "res.company", orm.FieldOpts{String: "Company"}),
		orm.Text("notes", orm.FieldOpts{String: "Notes"}),
	)
}
