package service

import (
	"context"

	"bsm/full/module/base/ads/internal/server"
	pb "bsm/full/module/base/ads/pb"
	gwRuntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
	"google.golang.org/grpc"
)

type ExposeOptions struct {
	Dependencies
	GRPC    *grpc.Server
	Gateway *gwRuntime.ServeMux
}

func Expose(options ExposeOptions) error {
	applyDependencies(options.Dependencies)
	server.New(options.GRPC)

	ctx := context.Background()
	if err := pb.RegisterFetchHandlerServer(ctx, options.Gateway, server.NewFetchServer()); err != nil {
		return err
	}
	return nil
}
