package generator

import (
	"fmt"
	"math/rand"
)

type PlanetClass string

const (
	PlanetClassHW        PlanetClass = "HW"
	PlanetClassDW        PlanetClass = "DW"
	PlanetClassGiant     PlanetClass = "Giant"
	PlanetClassBig       PlanetClass = "Big"
	PlanetClassNormal    PlanetClass = "Normal"
	PlanetClassRich      PlanetClass = "Rich"
	PlanetClassAsterioid PlanetClass = "Asteroid"
)

type Planet struct {
	PlanetClass PlanetClass
	Position    Coordinate
	Size        float64
	Resources   float64 // Сырьё
}

type PlanetarySystem struct {
	HW Planet
	DW []Planet
}

func (p Planet) RandomName() string {
	return fmt.Sprintf("%s-%04d-%04d", p.PlanetClass, rand.Intn(1000), rand.Intn(1000))
}

func NewPlanet(pc PlanetClass, c Coordinate, size, resources float64) Planet {
	return Planet{
		PlanetClass: pc,
		Position:    c,
		Size:        size,
		Resources:   resources,
	}
}
