package model

import (
	"gorm.io/gorm"
	"time"
)

type Position struct {
	ID          uint           `gorm:"primaryKey" json:"id"`
	PositionId  string         `json:"position_id" gorm:"index"`
	Name        string         `json:"name"`
	Description string         `json:"description" gorm:"type:text"`
	ParentId    uint           `json:"parent_id"`
	Children    []*Position    `json:"children" gorm:"foreignkey:ParentId"`
	CreatedAt   time.Time      `json:"created_at"`
	UpdatedAt   time.Time      `json:"-"`
	DeletedAt   gorm.DeletedAt `gorm:"index" json:"-"`
}

func (Position) TableName() string {
	return "positions"
}
