// Code generated by Fern. DO NOT EDIT.

package client

import (
	context "context"
	management "github.com/auth0/go-auth0/v2/management"
	core "github.com/auth0/go-auth0/v2/management/core"
	internal "github.com/auth0/go-auth0/v2/management/internal"
	errors "github.com/auth0/go-auth0/v2/management/jobs/errors"
	usersexports "github.com/auth0/go-auth0/v2/management/jobs/usersexports"
	usersimports "github.com/auth0/go-auth0/v2/management/jobs/usersimports"
	verificationemail "github.com/auth0/go-auth0/v2/management/jobs/verificationemail"
	option "github.com/auth0/go-auth0/v2/management/option"
)

type Client struct {
	WithRawResponse   *RawClient
	UsersExports      *usersexports.Client
	UsersImports      *usersimports.Client
	VerificationEmail *verificationemail.Client
	Errors            *errors.Client

	options *core.RequestOptions
	baseURL string
	caller  *internal.Caller
}

func NewClient(options *core.RequestOptions) *Client {
	return &Client{
		UsersExports:      usersexports.NewClient(options),
		UsersImports:      usersimports.NewClient(options),
		VerificationEmail: verificationemail.NewClient(options),
		Errors:            errors.NewClient(options),
		WithRawResponse:   NewRawClient(options),
		options:           options,
		baseURL:           options.BaseURL,
		caller: internal.NewCaller(
			&internal.CallerParams{
				Client:      options.HTTPClient,
				MaxAttempts: options.MaxAttempts,
			},
		),
	}
}

// Retrieves a job. Useful to check its status.
func (c *Client) Get(
	ctx context.Context,
	// ID of the job.
	id string,
	opts ...option.RequestOption,
) (*management.GetJobResponseContent, error) {
	response, err := c.WithRawResponse.Get(
		ctx,
		id,
		opts...,
	)
	if err != nil {
		return nil, err
	}
	return response.Body, nil
}
