package game_service

import (
	"evening_detective_server/internal/repos"
	"evening_detective_server/internal/services/scenarios_service"
)

func mapGame(
	o *repos.Game,
	domain string,
) *Game {
	return &Game{
		ID:          o.ID,
		Name:        o.Name,
		Description: o.Description,
		StartAt:     o.StartAt,
		Status:      o.Status,
		Scenario:    scenarios_service.MapScenarioLight(o.Scenario, domain),
		Teams:       mapTeams(o.Teams),
		StartedAt:   o.StartedAt,
		EndedAt:     o.EndedAt,
	}
}

func mapGames(
	o []*repos.Game,
	domain string,
) []*Game {
	res := make([]*Game, 0, len(o))
	for _, item := range o {
		res = append(res, mapGame(item, domain))
	}
	return res
}
