package service

import (
	"context"
	"github.com/UpmeshLTD/urus-aio/infrastructure/utils"
	"github.com/UpmeshLTD/urus-aio/service-template/server/grpc/pb"
)

type iGRPC interface {
	Ping(ctx context.Context, req *pb.PingRequest) (*pb.PingResponse, error)
}

func (s *serviceImpl) Ping(ctx context.Context, req *pb.PingRequest) (*pb.PingResponse, error) {
	info := utils.GetInfo(s.config.IsDevelopment())
	return &pb.PingResponse{
		Timestamps:  info["timestamps"].(int64),
		Environment: info["environment"].(string),
		Hostname:    info["hostname"].(string),
	}, nil
}
