package models

type Category struct {
	ID           uint   `gorm:"primaryKey;autoIncrement" json:"id"`
	Code         string `gorm:"size:20;uniqueIndex;not null" json:"code"`
	Name         string `gorm:"size:100;not null" json:"name"`
	NameRu       string `gorm:"size:100" json:"name_ru"`
	DisplayOrder int    `gorm:"default:0" json:"display_order"`
	IsRequired   bool   `gorm:"default:false" json:"is_required"`
}

func (Category) TableName() string {
	return "qt_categories"
}

// DefaultCategories defines the standard categories with display order.
// Canonical order: MB, CPU, MEM, RAID, storage drives, PCIe GPU, PCIe NICs, HBA, PSU, accessories, other.
// Display orders use gaps of 10 to allow future insertions without renumbering.
var DefaultCategories = []Category{
	{Code: "MB", Name: "Motherboard", NameRu: "Материнская плата", DisplayOrder: 10},
	{Code: "CPU", Name: "Processor", NameRu: "Процессор", DisplayOrder: 20, IsRequired: true},
	{Code: "MEM", Name: "Memory", NameRu: "Оперативная память", DisplayOrder: 30, IsRequired: true},
	{Code: "RAID", Name: "RAID Controller", NameRu: "RAID контроллер", DisplayOrder: 40},
	{Code: "SSD", Name: "SSD Storage", NameRu: "SSD накопитель", DisplayOrder: 50},
	{Code: "HDD", Name: "HDD Storage", NameRu: "HDD накопитель", DisplayOrder: 51},
	{Code: "M2", Name: "M.2 Storage", NameRu: "M.2 накопитель", DisplayOrder: 52},
	{Code: "EDSFF", Name: "EDSFF Storage", NameRu: "EDSFF накопитель", DisplayOrder: 53},
	{Code: "HHHL", Name: "HHHL Storage", NameRu: "HHHL накопитель", DisplayOrder: 54},
	{Code: "GPU", Name: "Graphics Card", NameRu: "Видеокарта", DisplayOrder: 60},
	{Code: "NIC", Name: "Network Card", NameRu: "Сетевая карта", DisplayOrder: 70},
	{Code: "HCA", Name: "HCA Adapter", NameRu: "HCA адаптер", DisplayOrder: 71},
	{Code: "DPU", Name: "DPU", NameRu: "DPU", DisplayOrder: 72},
	{Code: "HBA", Name: "HBA Adapter", NameRu: "HBA адаптер", DisplayOrder: 80},
	{Code: "PSU", Name: "Power Supply", NameRu: "Блок питания", DisplayOrder: 90},
	{Code: "PS", Name: "Power Supply (Legacy)", NameRu: "Блок питания", DisplayOrder: 91},
	{Code: "ACC", Name: "Accessories", NameRu: "Аксессуары", DisplayOrder: 100},
	{Code: "RISERS", Name: "Risers", NameRu: "Райзеры", DisplayOrder: 101},
	{Code: "CARD", Name: "Cards", NameRu: "Карты", DisplayOrder: 110},
	{Code: "BB", Name: "Barebone", NameRu: "Шасси", DisplayOrder: 120, IsRequired: true},
}

// MaxKnownDisplayOrder is the highest display order for known categories.
// New categories will get display order starting from this + 1.
const MaxKnownDisplayOrder = 200
