package main

import (
	"context"
	"fmt"

	pb "gitlab.ost.ch/marketminds/marketminds/pkg/protobuf"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
)

func grpc_testing() {
	var opts []grpc.DialOption
	opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))

	conn, err := grpc.Dial("localhost:50051", opts...)
	if err != nil {
		panic(err)
	}
	defer conn.Close()

	client2 := pb.NewSentimentAnalyzerClient(conn)

	request2 := &pb.AnalyzeSentimentRequest{
		Text: "VW gewinnt den Prozess gegen die EU-Kommission. Das ist eine gute Nachricht für die Aktionäre",
	}

	response2, err2 := client2.AnalyzeSentiment(context.Background(), request2)
	if err2 != nil {
		panic(err2)
	}

	fmt.Printf("Positive Score: %v\n", response2.PositiveScore)
	fmt.Printf("Negative Score: %v\n", response2.NegativeScore)
	fmt.Printf("Neutral Score: %v\n", response2.NeutralScore)
}
