// Code generated by sdkgen-v2. DO NOT EDIT.
package dnssdk

import (
	"context"

	access "github.com/yandex-cloud/go-genproto/yandex/cloud/access"
	dns "github.com/yandex-cloud/go-genproto/yandex/cloud/dns/v1"
	operation "github.com/yandex-cloud/go-genproto/yandex/cloud/operation"
	"github.com/yandex-cloud/go-sdk/v2/pkg/iterator"
	"google.golang.org/grpc"
)

type DnsInboundEndpointClientIterator interface {
	Iterator(context.Context, *dns.ListDnsInboundEndpointsRequest, ...grpc.CallOption) *iterator.Iterator[*dns.ListDnsInboundEndpointsRequest, *dns.DnsInboundEndpoint]
	OperationsIterator(context.Context, *dns.ListDnsInboundEndpointOperationsRequest, ...grpc.CallOption) *iterator.Iterator[*dns.ListDnsInboundEndpointOperationsRequest, *operation.Operation]
	AccessBindingsIterator(context.Context, *access.ListAccessBindingsRequest, ...grpc.CallOption) *iterator.Iterator[*access.ListAccessBindingsRequest, *access.AccessBinding]
}

type dnsInboundEndpointServiceListInternal struct {
	*dns.ListDnsInboundEndpointsResponse
}

func (r dnsInboundEndpointServiceListInternal) Items() []*dns.DnsInboundEndpoint {
	return r.ListDnsInboundEndpointsResponse.Endpoints
}

func (c dnsInboundEndpointClient) Iterator(ctx context.Context, req *dns.ListDnsInboundEndpointsRequest, opts ...grpc.CallOption) *iterator.Iterator[*dns.ListDnsInboundEndpointsRequest, *dns.DnsInboundEndpoint] {
	return iterator.NewIterator[*dns.ListDnsInboundEndpointsRequest, *dns.DnsInboundEndpoint](ctx, req,
		func(ctx context.Context, req *dns.ListDnsInboundEndpointsRequest, opts ...grpc.CallOption) (iterator.PageResponse[*dns.DnsInboundEndpoint], error) {
			resp, err := c.List(ctx, req, opts...)
			if err != nil {
				return nil, err
			}
			return dnsInboundEndpointServiceListInternal{resp}, nil
		})
}

type dnsInboundEndpointServiceListOperationsInternal struct {
	*dns.ListDnsInboundEndpointOperationsResponse
}

func (r dnsInboundEndpointServiceListOperationsInternal) Items() []*operation.Operation {
	return r.ListDnsInboundEndpointOperationsResponse.Operations
}

func (c dnsInboundEndpointClient) OperationsIterator(ctx context.Context, req *dns.ListDnsInboundEndpointOperationsRequest, opts ...grpc.CallOption) *iterator.Iterator[*dns.ListDnsInboundEndpointOperationsRequest, *operation.Operation] {
	return iterator.NewIterator[*dns.ListDnsInboundEndpointOperationsRequest, *operation.Operation](ctx, req,
		func(ctx context.Context, req *dns.ListDnsInboundEndpointOperationsRequest, opts ...grpc.CallOption) (iterator.PageResponse[*operation.Operation], error) {
			resp, err := c.ListOperations(ctx, req, opts...)
			if err != nil {
				return nil, err
			}
			return dnsInboundEndpointServiceListOperationsInternal{resp}, nil
		})
}

type dnsInboundEndpointServiceListAccessBindingsInternal struct {
	*access.ListAccessBindingsResponse
}

func (r dnsInboundEndpointServiceListAccessBindingsInternal) Items() []*access.AccessBinding {
	return r.ListAccessBindingsResponse.AccessBindings
}

func (c dnsInboundEndpointClient) AccessBindingsIterator(ctx context.Context, req *access.ListAccessBindingsRequest, opts ...grpc.CallOption) *iterator.Iterator[*access.ListAccessBindingsRequest, *access.AccessBinding] {
	return iterator.NewIterator[*access.ListAccessBindingsRequest, *access.AccessBinding](ctx, req,
		func(ctx context.Context, req *access.ListAccessBindingsRequest, opts ...grpc.CallOption) (iterator.PageResponse[*access.AccessBinding], error) {
			resp, err := c.ListAccessBindings(ctx, req, opts...)
			if err != nil {
				return nil, err
			}
			return dnsInboundEndpointServiceListAccessBindingsInternal{resp}, nil
		})
}
