package psc

import (
	"context"

	compute "cloud.google.com/go/compute/apiv1"
	gax "github.com/googleapis/gax-go/v2"
	"google.golang.org/api/dns/v1"

	computepb "cloud.google.com/go/compute/apiv1/computepb"
)

type CloudPSCClient interface {
	Get(ctx context.Context, req *computepb.GetServiceAttachmentRequest, opts ...gax.CallOption) (*computepb.ServiceAttachment, error)
	Patch(ctx context.Context, req *computepb.PatchServiceAttachmentRequest, opts ...gax.CallOption) (Operation, error)
}
type Operation interface {
	Wait(ctx context.Context, opts ...gax.CallOption) error
}

type PSCClientWrap struct {
	*compute.ServiceAttachmentsClient
}

func (p *PSCClientWrap) Patch(ctx context.Context, req *computepb.PatchServiceAttachmentRequest, opts ...gax.CallOption) (Operation, error) {
	return p.ServiceAttachmentsClient.Patch(ctx, req, opts...)
}

type CloudPSCRuleClient interface {
	Get(ctx context.Context, req *computepb.GetForwardingRuleRequest, opts ...gax.CallOption) (*computepb.ForwardingRule, error)
	Patch(ctx context.Context, req *computepb.PatchForwardingRuleRequest, opts ...gax.CallOption) (Operation, error)
	Insert(ctx context.Context, req *computepb.InsertForwardingRuleRequest, opts ...gax.CallOption) (Operation, error)
	Delete(ctx context.Context, req *computepb.DeleteForwardingRuleRequest, opts ...gax.CallOption) (Operation, error)
}
type PSCRuleClientWrap struct {
	*compute.ForwardingRulesClient
}

func (p *PSCRuleClientWrap) Patch(ctx context.Context, req *computepb.PatchForwardingRuleRequest, opts ...gax.CallOption) (Operation, error) {
	return p.ForwardingRulesClient.Patch(ctx, req, opts...)
}

func (p *PSCRuleClientWrap) Insert(ctx context.Context, req *computepb.InsertForwardingRuleRequest, opts ...gax.CallOption) (Operation, error) {
	return p.ForwardingRulesClient.Insert(ctx, req, opts...)
}

func (p *PSCRuleClientWrap) Delete(ctx context.Context, req *computepb.DeleteForwardingRuleRequest, opts ...gax.CallOption) (Operation, error) {
	return p.ForwardingRulesClient.Delete(ctx, req, opts...)
}

type CloudPSCAddressClient interface {
	Get(ctx context.Context, req *computepb.GetAddressRequest, opts ...gax.CallOption) (*computepb.Address, error)
	Insert(ctx context.Context, req *computepb.InsertAddressRequest, opts ...gax.CallOption) (Operation, error)
	Delete(ctx context.Context, req *computepb.DeleteAddressRequest, opts ...gax.CallOption) (Operation, error)
}
type PSCAddressClientWrap struct {
	*compute.AddressesClient
}

func (p *PSCAddressClientWrap) Insert(ctx context.Context, req *computepb.InsertAddressRequest, opts ...gax.CallOption) (Operation, error) {
	return p.AddressesClient.Insert(ctx, req, opts...)
}

func (p *PSCAddressClientWrap) Delete(ctx context.Context, req *computepb.DeleteAddressRequest, opts ...gax.CallOption) (Operation, error) {
	return p.AddressesClient.Delete(ctx, req, opts...)
}

type CloudDNSZonesClient interface {
	Get(project string, managedZone string) *dns.ManagedZonesGetCall
}

type DNSZonesClientWrap struct {
	*dns.ManagedZonesService
}
