package app

import (
	"context"
	"evening_detective/internal/services"
	proto "evening_detective/proto"
)

type Server struct {
	proto.UnimplementedEveningDetectiveServer

	services *services.Services
}

func NewServer(
	services *services.Services,
) *Server {
	return &Server{
		services: services,
	}
}

func (s *Server) Ping(_ context.Context, _ *proto.PingReq) (*proto.PingRsp, error) {
	return &proto.PingRsp{}, nil
}

func (s *Server) AddTeams(ctx context.Context, req *proto.AddTeamsReq) (*proto.AddTeamsRsp, error) {
	return s.services.AddTeams(ctx, req)
}

func (s *Server) GetTeams(ctx context.Context, req *proto.GetTeamsReq) (*proto.GetTeamsRsp, error) {
	return s.services.GetTeams(ctx, req)
}

func (s *Server) GetTeamsCSV(ctx context.Context, req *proto.GetTeamsCSVReq) (*proto.GetTeamsCSVRsp, error) {
	return s.services.GetTeamsCSV(ctx, req)
}

func (s *Server) GetTeam(ctx context.Context, req *proto.GetTeamReq) (*proto.GetTeamRsp, error) {
	return s.services.GetTeam(ctx, req)
}

func (s *Server) AddAction(ctx context.Context, req *proto.AddActionReq) (*proto.AddActionRsp, error) {
	return s.services.AddAction(ctx, req)
}

func (s *Server) GetGame(ctx context.Context, req *proto.GetGameReq) (*proto.GetGameRsp, error) {
	return s.services.GetGame(ctx, req)
}

func (s *Server) GameStart(ctx context.Context, req *proto.GameStartReq) (*proto.GameStartRsp, error) {
	return s.services.GameStart(ctx, req)
}

func (s *Server) GameStop(ctx context.Context, req *proto.GameStopReq) (*proto.GameStopRsp, error) {
	return s.services.GameStop(ctx, req)
}

func (s *Server) GiveApplications(ctx context.Context, req *proto.GiveApplicationsReq) (*proto.GiveApplicationsRsp, error) {
	return s.services.GiveApplications(ctx, req)
}

func (s *Server) DownloadTeamsQrCodesFile(ctx context.Context, req *proto.DownloadTeamsQrCodesFileReq) (*proto.DownloadTeamsQrCodesFileRsp, error) {
	return s.services.DownloadTeamsQrCodesFile(ctx, req)
}

func (s *Server) GetGraph(ctx context.Context, req *proto.GetGraphReq) (*proto.GetGraphRsp, error) {
	return s.services.GetGraph(ctx, req)
}

func (s *Server) UpdateNode(ctx context.Context, req *proto.UpdateNodeReq) (*proto.UpdateNodeRsp, error) {
	return s.services.UpdateNode(ctx, req)
}
