package db

import (
	"github.com/jmoiron/sqlx"
)

type Package struct {
	Db *sqlx.DB
}

type Interface interface {
	GetPokemons() ([]Pokemon, error)
}

type Pokemon struct {
	ID             int    `db:"id"`
	Name           string `db:"name"`
	ShinyEnabled   bool   `db:"shiny_enabled"`
	ShinyImageName string `db:"shiny_image_name"`
	ImageName      string `db:"image_name"`
}

func (p *Package) GetPokemons() ([]Pokemon, error) {
	var pokemons []Pokemon
	err := p.Db.Select(&pokemons, "SELECT * FROM pokemon where shiny_enabled=true")
	return pokemons, err
}
