// Provenance-includes-location: https://github.com/cortexproject/cortex/blob/master/pkg/alertmanager/alertmanagerpb/alertmanager.proto
// Provenance-includes-license: Apache-2.0
// Provenance-includes-copyright: The Cortex Authors.
// SPDX-License-Identifier: AGPL-3.0-only

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc             v3.21.12
// source: alertmanager.proto

package alertmanagerpb

import (
	context "context"
	httpgrpc "github.com/grafana/dskit/httpgrpc"
	clusterpb "github.com/prometheus/alertmanager/cluster/clusterpb"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9

const (
	Alertmanager_HandleRequest_FullMethodName = "/alertmanagerpb.Alertmanager/HandleRequest"
	Alertmanager_UpdateState_FullMethodName   = "/alertmanagerpb.Alertmanager/UpdateState"
	Alertmanager_ReadState_FullMethodName     = "/alertmanagerpb.Alertmanager/ReadState"
)

// AlertmanagerClient is the client API for Alertmanager service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Alertmanager interface exposed to the Alertmanager Distributor and other Alertmanagers
type AlertmanagerClient interface {
	HandleRequest(ctx context.Context, in *httpgrpc.HTTPRequest, opts ...grpc.CallOption) (*httpgrpc.HTTPResponse, error)
	UpdateState(ctx context.Context, in *clusterpb.Part, opts ...grpc.CallOption) (*UpdateStateResponse, error)
	ReadState(ctx context.Context, in *ReadStateRequest, opts ...grpc.CallOption) (*ReadStateResponse, error)
}

type alertmanagerClient struct {
	cc grpc.ClientConnInterface
}

func NewAlertmanagerClient(cc grpc.ClientConnInterface) AlertmanagerClient {
	return &alertmanagerClient{cc}
}

func (c *alertmanagerClient) HandleRequest(ctx context.Context, in *httpgrpc.HTTPRequest, opts ...grpc.CallOption) (*httpgrpc.HTTPResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(httpgrpc.HTTPResponse)
	err := c.cc.Invoke(ctx, Alertmanager_HandleRequest_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *alertmanagerClient) UpdateState(ctx context.Context, in *clusterpb.Part, opts ...grpc.CallOption) (*UpdateStateResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(UpdateStateResponse)
	err := c.cc.Invoke(ctx, Alertmanager_UpdateState_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *alertmanagerClient) ReadState(ctx context.Context, in *ReadStateRequest, opts ...grpc.CallOption) (*ReadStateResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ReadStateResponse)
	err := c.cc.Invoke(ctx, Alertmanager_ReadState_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// AlertmanagerServer is the server API for Alertmanager service.
// All implementations should embed UnimplementedAlertmanagerServer
// for forward compatibility.
//
// Alertmanager interface exposed to the Alertmanager Distributor and other Alertmanagers
type AlertmanagerServer interface {
	HandleRequest(context.Context, *httpgrpc.HTTPRequest) (*httpgrpc.HTTPResponse, error)
	UpdateState(context.Context, *clusterpb.Part) (*UpdateStateResponse, error)
	ReadState(context.Context, *ReadStateRequest) (*ReadStateResponse, error)
}

// UnimplementedAlertmanagerServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedAlertmanagerServer struct{}

func (UnimplementedAlertmanagerServer) HandleRequest(context.Context, *httpgrpc.HTTPRequest) (*httpgrpc.HTTPResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method HandleRequest not implemented")
}
func (UnimplementedAlertmanagerServer) UpdateState(context.Context, *clusterpb.Part) (*UpdateStateResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method UpdateState not implemented")
}
func (UnimplementedAlertmanagerServer) ReadState(context.Context, *ReadStateRequest) (*ReadStateResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method ReadState not implemented")
}
func (UnimplementedAlertmanagerServer) testEmbeddedByValue() {}

// UnsafeAlertmanagerServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AlertmanagerServer will
// result in compilation errors.
type UnsafeAlertmanagerServer interface {
	mustEmbedUnimplementedAlertmanagerServer()
}

func RegisterAlertmanagerServer(s grpc.ServiceRegistrar, srv AlertmanagerServer) {
	// If the following call panics, it indicates UnimplementedAlertmanagerServer was
	// embedded by pointer and is nil.  This will cause panics if an
	// unimplemented method is ever invoked, so we test this at initialization
	// time to prevent it from happening at runtime later due to I/O.
	if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
		t.testEmbeddedByValue()
	}
	s.RegisterService(&Alertmanager_ServiceDesc, srv)
}

func _Alertmanager_HandleRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(httpgrpc.HTTPRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(AlertmanagerServer).HandleRequest(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Alertmanager_HandleRequest_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(AlertmanagerServer).HandleRequest(ctx, req.(*httpgrpc.HTTPRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Alertmanager_UpdateState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(clusterpb.Part)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(AlertmanagerServer).UpdateState(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Alertmanager_UpdateState_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(AlertmanagerServer).UpdateState(ctx, req.(*clusterpb.Part))
	}
	return interceptor(ctx, in, info, handler)
}

func _Alertmanager_ReadState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ReadStateRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(AlertmanagerServer).ReadState(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Alertmanager_ReadState_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(AlertmanagerServer).ReadState(ctx, req.(*ReadStateRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// Alertmanager_ServiceDesc is the grpc.ServiceDesc for Alertmanager service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Alertmanager_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "alertmanagerpb.Alertmanager",
	HandlerType: (*AlertmanagerServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "HandleRequest",
			Handler:    _Alertmanager_HandleRequest_Handler,
		},
		{
			MethodName: "UpdateState",
			Handler:    _Alertmanager_UpdateState_Handler,
		},
		{
			MethodName: "ReadState",
			Handler:    _Alertmanager_ReadState_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "alertmanager.proto",
}
