// Code generated by protoc-gen-go-flipt-sdk. DO NOT EDIT.

package sdk

import (
	context "context"
	auth "go.flipt.io/flipt/rpc/flipt/auth"
	emptypb "google.golang.org/protobuf/types/known/emptypb"
)

type AuthClient interface {
	PublicAuthenticationServiceClient() auth.PublicAuthenticationServiceClient
	AuthenticationServiceClient() auth.AuthenticationServiceClient
	AuthenticationMethodTokenServiceClient() auth.AuthenticationMethodTokenServiceClient
	AuthenticationMethodOIDCServiceClient() auth.AuthenticationMethodOIDCServiceClient
	AuthenticationMethodKubernetesServiceClient() auth.AuthenticationMethodKubernetesServiceClient
	AuthenticationMethodGithubServiceClient() auth.AuthenticationMethodGithubServiceClient
}

type Auth struct {
	transport              AuthClient
	authenticationProvider ClientAuthenticationProvider
}

type PublicAuthenticationService struct {
	transport              auth.PublicAuthenticationServiceClient
	authenticationProvider ClientAuthenticationProvider
}

func (s Auth) PublicAuthenticationService() *PublicAuthenticationService {
	return &PublicAuthenticationService{
		transport:              s.transport.PublicAuthenticationServiceClient(),
		authenticationProvider: s.authenticationProvider,
	}
}
func (x *PublicAuthenticationService) ListAuthenticationMethods(ctx context.Context) (*auth.ListAuthenticationMethodsResponse, error) {
	ctx, err := authenticate(ctx, x.authenticationProvider)
	if err != nil {
		return nil, err
	}
	return x.transport.ListAuthenticationMethods(ctx, &emptypb.Empty{})
}

type AuthenticationService struct {
	transport              auth.AuthenticationServiceClient
	authenticationProvider ClientAuthenticationProvider
}

func (s Auth) AuthenticationService() *AuthenticationService {
	return &AuthenticationService{
		transport:              s.transport.AuthenticationServiceClient(),
		authenticationProvider: s.authenticationProvider,
	}
}
func (x *AuthenticationService) GetAuthenticationSelf(ctx context.Context) (*auth.Authentication, error) {
	ctx, err := authenticate(ctx, x.authenticationProvider)
	if err != nil {
		return nil, err
	}
	return x.transport.GetAuthenticationSelf(ctx, &emptypb.Empty{})
}

func (x *AuthenticationService) GetAuthentication(ctx context.Context, v *auth.GetAuthenticationRequest) (*auth.Authentication, error) {
	ctx, err := authenticate(ctx, x.authenticationProvider)
	if err != nil {
		return nil, err
	}
	return x.transport.GetAuthentication(ctx, v)
}

func (x *AuthenticationService) ListAuthentications(ctx context.Context, v *auth.ListAuthenticationsRequest) (*auth.ListAuthenticationsResponse, error) {
	ctx, err := authenticate(ctx, x.authenticationProvider)
	if err != nil {
		return nil, err
	}
	return x.transport.ListAuthentications(ctx, v)
}

func (x *AuthenticationService) DeleteAuthentication(ctx context.Context, v *auth.DeleteAuthenticationRequest) error {
	ctx, err := authenticate(ctx, x.authenticationProvider)
	if err != nil {
		return err
	}
	_, err = x.transport.DeleteAuthentication(ctx, v)
	return err
}

func (x *AuthenticationService) ExpireAuthenticationSelf(ctx context.Context, v *auth.ExpireAuthenticationSelfRequest) error {
	ctx, err := authenticate(ctx, x.authenticationProvider)
	if err != nil {
		return err
	}
	_, err = x.transport.ExpireAuthenticationSelf(ctx, v)
	return err
}

type AuthenticationMethodTokenService struct {
	transport              auth.AuthenticationMethodTokenServiceClient
	authenticationProvider ClientAuthenticationProvider
}

func (s Auth) AuthenticationMethodTokenService() *AuthenticationMethodTokenService {
	return &AuthenticationMethodTokenService{
		transport:              s.transport.AuthenticationMethodTokenServiceClient(),
		authenticationProvider: s.authenticationProvider,
	}
}
func (x *AuthenticationMethodTokenService) CreateToken(ctx context.Context, v *auth.CreateTokenRequest) (*auth.CreateTokenResponse, error) {
	ctx, err := authenticate(ctx, x.authenticationProvider)
	if err != nil {
		return nil, err
	}
	return x.transport.CreateToken(ctx, v)
}

type AuthenticationMethodOIDCService struct {
	transport              auth.AuthenticationMethodOIDCServiceClient
	authenticationProvider ClientAuthenticationProvider
}

func (s Auth) AuthenticationMethodOIDCService() *AuthenticationMethodOIDCService {
	return &AuthenticationMethodOIDCService{
		transport:              s.transport.AuthenticationMethodOIDCServiceClient(),
		authenticationProvider: s.authenticationProvider,
	}
}
func (x *AuthenticationMethodOIDCService) AuthorizeURL(ctx context.Context, v *auth.AuthorizeURLRequest) (*auth.AuthorizeURLResponse, error) {
	ctx, err := authenticate(ctx, x.authenticationProvider)
	if err != nil {
		return nil, err
	}
	return x.transport.AuthorizeURL(ctx, v)
}

func (x *AuthenticationMethodOIDCService) Callback(ctx context.Context, v *auth.CallbackRequest) (*auth.CallbackResponse, error) {
	ctx, err := authenticate(ctx, x.authenticationProvider)
	if err != nil {
		return nil, err
	}
	return x.transport.Callback(ctx, v)
}

type AuthenticationMethodKubernetesService struct {
	transport              auth.AuthenticationMethodKubernetesServiceClient
	authenticationProvider ClientAuthenticationProvider
}

func (s Auth) AuthenticationMethodKubernetesService() *AuthenticationMethodKubernetesService {
	return &AuthenticationMethodKubernetesService{
		transport:              s.transport.AuthenticationMethodKubernetesServiceClient(),
		authenticationProvider: s.authenticationProvider,
	}
}
func (x *AuthenticationMethodKubernetesService) VerifyServiceAccount(ctx context.Context, v *auth.VerifyServiceAccountRequest) (*auth.VerifyServiceAccountResponse, error) {
	ctx, err := authenticate(ctx, x.authenticationProvider)
	if err != nil {
		return nil, err
	}
	return x.transport.VerifyServiceAccount(ctx, v)
}

type AuthenticationMethodGithubService struct {
	transport              auth.AuthenticationMethodGithubServiceClient
	authenticationProvider ClientAuthenticationProvider
}

func (s Auth) AuthenticationMethodGithubService() *AuthenticationMethodGithubService {
	return &AuthenticationMethodGithubService{
		transport:              s.transport.AuthenticationMethodGithubServiceClient(),
		authenticationProvider: s.authenticationProvider,
	}
}
func (x *AuthenticationMethodGithubService) AuthorizeURL(ctx context.Context, v *auth.AuthorizeURLRequest) (*auth.AuthorizeURLResponse, error) {
	ctx, err := authenticate(ctx, x.authenticationProvider)
	if err != nil {
		return nil, err
	}
	return x.transport.AuthorizeURL(ctx, v)
}

func (x *AuthenticationMethodGithubService) Callback(ctx context.Context, v *auth.CallbackRequest) (*auth.CallbackResponse, error) {
	ctx, err := authenticate(ctx, x.authenticationProvider)
	if err != nil {
		return nil, err
	}
	return x.transport.Callback(ctx, v)
}
