package psql

import (
	"kurumibot/database"

	"github.com/shopspring/decimal"
)

type Work struct {
	ID            int
	Name          string
	RequiredLevel int
	MoneyIncome   decimal.Decimal
	MinExp        int
	MaxExp        int
}

func GetWorkById(id int) (*Work, error) {
	work := new(Work)
	tx := database.PostgresDatabase.First(work, id)
	return work, tx.Error
}

func GetAllWorks() ([]*Work, error) {
	works := make([]*Work, 0)
	tx := database.PostgresDatabase.Order("id").Find(&works)
	return works, tx.Error
}
