// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

package dns

import (
	"context"
	"errors"
	"fmt"
	"net/http"
	"slices"
	"time"

	"github.com/cloudflare/cloudflare-go/v6/internal/apijson"
	"github.com/cloudflare/cloudflare-go/v6/internal/param"
	"github.com/cloudflare/cloudflare-go/v6/internal/requestconfig"
	"github.com/cloudflare/cloudflare-go/v6/option"
)

// DNSSECService contains methods and other services that help with interacting
// with the cloudflare API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewDNSSECService] method instead.
type DNSSECService struct {
	Options []option.RequestOption
}

// NewDNSSECService generates a new service that applies the given options to each
// request. These options are applied after the parent client's options (if there
// is one), and before any request-specific options.
func NewDNSSECService(opts ...option.RequestOption) (r *DNSSECService) {
	r = &DNSSECService{}
	r.Options = opts
	return
}

// Delete DNSSEC.
func (r *DNSSECService) Delete(ctx context.Context, body DNSSECDeleteParams, opts ...option.RequestOption) (res *string, err error) {
	var env DNSSECDeleteResponseEnvelope
	opts = slices.Concat(r.Options, opts)
	if body.ZoneID.Value == "" {
		err = errors.New("missing required zone_id parameter")
		return
	}
	path := fmt.Sprintf("zones/%s/dnssec", body.ZoneID)
	err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...)
	if err != nil {
		return
	}
	res = &env.Result
	return
}

// Enable or disable DNSSEC.
func (r *DNSSECService) Edit(ctx context.Context, params DNSSECEditParams, opts ...option.RequestOption) (res *DNSSEC, err error) {
	var env DNSSECEditResponseEnvelope
	opts = slices.Concat(r.Options, opts)
	if params.ZoneID.Value == "" {
		err = errors.New("missing required zone_id parameter")
		return
	}
	path := fmt.Sprintf("zones/%s/dnssec", params.ZoneID)
	err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...)
	if err != nil {
		return
	}
	res = &env.Result
	return
}

// Details about DNSSEC status and configuration.
func (r *DNSSECService) Get(ctx context.Context, query DNSSECGetParams, opts ...option.RequestOption) (res *DNSSEC, err error) {
	var env DNSSECGetResponseEnvelope
	opts = slices.Concat(r.Options, opts)
	if query.ZoneID.Value == "" {
		err = errors.New("missing required zone_id parameter")
		return
	}
	path := fmt.Sprintf("zones/%s/dnssec", query.ZoneID)
	err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
	if err != nil {
		return
	}
	res = &env.Result
	return
}

type DNSSEC struct {
	// Algorithm key code.
	Algorithm string `json:"algorithm,nullable"`
	// Digest hash.
	Digest string `json:"digest,nullable"`
	// Type of digest algorithm.
	DigestAlgorithm string `json:"digest_algorithm,nullable"`
	// Coded type for digest algorithm.
	DigestType string `json:"digest_type,nullable"`
	// If true, multi-signer DNSSEC is enabled on the zone, allowing multiple providers
	// to serve a DNSSEC-signed zone at the same time. This is required for DNSKEY
	// records (except those automatically generated by Cloudflare) to be added to the
	// zone.
	//
	// See
	// [Multi-signer DNSSEC](https://developers.cloudflare.com/dns/dnssec/multi-signer-dnssec/)
	// for details.
	DNSSECMultiSigner bool `json:"dnssec_multi_signer"`
	// If true, allows Cloudflare to transfer in a DNSSEC-signed zone including
	// signatures from an external provider, without requiring Cloudflare to sign any
	// records on the fly.
	//
	// Note that this feature has some limitations. See
	// [Cloudflare as Secondary](https://developers.cloudflare.com/dns/zone-setups/zone-transfers/cloudflare-as-secondary/setup/#dnssec)
	// for details.
	DNSSECPresigned bool `json:"dnssec_presigned"`
	// If true, enables the use of NSEC3 together with DNSSEC on the zone. Combined
	// with setting dnssec_presigned to true, this enables the use of NSEC3 records
	// when transferring in from an external provider. If dnssec_presigned is instead
	// set to false (default), NSEC3 records will be generated and signed at request
	// time.
	//
	// See
	// [DNSSEC with NSEC3](https://developers.cloudflare.com/dns/dnssec/enable-nsec3/)
	// for details.
	DNSSECUseNsec3 bool `json:"dnssec_use_nsec3"`
	// Full DS record.
	DS string `json:"ds,nullable"`
	// Flag for DNSSEC record.
	Flags float64 `json:"flags,nullable"`
	// Code for key tag.
	KeyTag float64 `json:"key_tag,nullable"`
	// Algorithm key type.
	KeyType string `json:"key_type,nullable"`
	// When DNSSEC was last modified.
	ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"`
	// Public key for DS record.
	PublicKey string `json:"public_key,nullable"`
	// Status of DNSSEC, based on user-desired state and presence of necessary records.
	Status DNSSECStatus `json:"status"`
	JSON   dnssecJSON   `json:"-"`
}

// dnssecJSON contains the JSON metadata for the struct [DNSSEC]
type dnssecJSON struct {
	Algorithm         apijson.Field
	Digest            apijson.Field
	DigestAlgorithm   apijson.Field
	DigestType        apijson.Field
	DNSSECMultiSigner apijson.Field
	DNSSECPresigned   apijson.Field
	DNSSECUseNsec3    apijson.Field
	DS                apijson.Field
	Flags             apijson.Field
	KeyTag            apijson.Field
	KeyType           apijson.Field
	ModifiedOn        apijson.Field
	PublicKey         apijson.Field
	Status            apijson.Field
	raw               string
	ExtraFields       map[string]apijson.Field
}

func (r *DNSSEC) UnmarshalJSON(data []byte) (err error) {
	return apijson.UnmarshalRoot(data, r)
}

func (r dnssecJSON) RawJSON() string {
	return r.raw
}

// Status of DNSSEC, based on user-desired state and presence of necessary records.
type DNSSECStatus string

const (
	DNSSECStatusActive          DNSSECStatus = "active"
	DNSSECStatusPending         DNSSECStatus = "pending"
	DNSSECStatusDisabled        DNSSECStatus = "disabled"
	DNSSECStatusPendingDisabled DNSSECStatus = "pending-disabled"
	DNSSECStatusError           DNSSECStatus = "error"
)

func (r DNSSECStatus) IsKnown() bool {
	switch r {
	case DNSSECStatusActive, DNSSECStatusPending, DNSSECStatusDisabled, DNSSECStatusPendingDisabled, DNSSECStatusError:
		return true
	}
	return false
}

type DNSSECDeleteParams struct {
	// Identifier.
	ZoneID param.Field[string] `path:"zone_id,required"`
}

type DNSSECDeleteResponseEnvelope struct {
	Errors   []DNSSECDeleteResponseEnvelopeErrors   `json:"errors,required"`
	Messages []DNSSECDeleteResponseEnvelopeMessages `json:"messages,required"`
	// Whether the API call was successful.
	Success DNSSECDeleteResponseEnvelopeSuccess `json:"success,required"`
	Result  string                              `json:"result"`
	JSON    dnssecDeleteResponseEnvelopeJSON    `json:"-"`
}

// dnssecDeleteResponseEnvelopeJSON contains the JSON metadata for the struct
// [DNSSECDeleteResponseEnvelope]
type dnssecDeleteResponseEnvelopeJSON struct {
	Errors      apijson.Field
	Messages    apijson.Field
	Success     apijson.Field
	Result      apijson.Field
	raw         string
	ExtraFields map[string]apijson.Field
}

func (r *DNSSECDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
	return apijson.UnmarshalRoot(data, r)
}

func (r dnssecDeleteResponseEnvelopeJSON) RawJSON() string {
	return r.raw
}

type DNSSECDeleteResponseEnvelopeErrors struct {
	Code             int64                                    `json:"code,required"`
	Message          string                                   `json:"message,required"`
	DocumentationURL string                                   `json:"documentation_url"`
	Source           DNSSECDeleteResponseEnvelopeErrorsSource `json:"source"`
	JSON             dnssecDeleteResponseEnvelopeErrorsJSON   `json:"-"`
}

// dnssecDeleteResponseEnvelopeErrorsJSON contains the JSON metadata for the struct
// [DNSSECDeleteResponseEnvelopeErrors]
type dnssecDeleteResponseEnvelopeErrorsJSON struct {
	Code             apijson.Field
	Message          apijson.Field
	DocumentationURL apijson.Field
	Source           apijson.Field
	raw              string
	ExtraFields      map[string]apijson.Field
}

func (r *DNSSECDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) {
	return apijson.UnmarshalRoot(data, r)
}

func (r dnssecDeleteResponseEnvelopeErrorsJSON) RawJSON() string {
	return r.raw
}

type DNSSECDeleteResponseEnvelopeErrorsSource struct {
	Pointer string                                       `json:"pointer"`
	JSON    dnssecDeleteResponseEnvelopeErrorsSourceJSON `json:"-"`
}

// dnssecDeleteResponseEnvelopeErrorsSourceJSON contains the JSON metadata for the
// struct [DNSSECDeleteResponseEnvelopeErrorsSource]
type dnssecDeleteResponseEnvelopeErrorsSourceJSON struct {
	Pointer     apijson.Field
	raw         string
	ExtraFields map[string]apijson.Field
}

func (r *DNSSECDeleteResponseEnvelopeErrorsSource) UnmarshalJSON(data []byte) (err error) {
	return apijson.UnmarshalRoot(data, r)
}

func (r dnssecDeleteResponseEnvelopeErrorsSourceJSON) RawJSON() string {
	return r.raw
}

type DNSSECDeleteResponseEnvelopeMessages struct {
	Code             int64                                      `json:"code,required"`
	Message          string                                     `json:"message,required"`
	DocumentationURL string                                     `json:"documentation_url"`
	Source           DNSSECDeleteResponseEnvelopeMessagesSource `json:"source"`
	JSON             dnssecDeleteResponseEnvelopeMessagesJSON   `json:"-"`
}

// dnssecDeleteResponseEnvelopeMessagesJSON contains the JSON metadata for the
// struct [DNSSECDeleteResponseEnvelopeMessages]
type dnssecDeleteResponseEnvelopeMessagesJSON struct {
	Code             apijson.Field
	Message          apijson.Field
	DocumentationURL apijson.Field
	Source           apijson.Field
	raw              string
	ExtraFields      map[string]apijson.Field
}

func (r *DNSSECDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) {
	return apijson.UnmarshalRoot(data, r)
}

func (r dnssecDeleteResponseEnvelopeMessagesJSON) RawJSON() string {
	return r.raw
}

type DNSSECDeleteResponseEnvelopeMessagesSource struct {
	Pointer string                                         `json:"pointer"`
	JSON    dnssecDeleteResponseEnvelopeMessagesSourceJSON `json:"-"`
}

// dnssecDeleteResponseEnvelopeMessagesSourceJSON contains the JSON metadata for
// the struct [DNSSECDeleteResponseEnvelopeMessagesSource]
type dnssecDeleteResponseEnvelopeMessagesSourceJSON struct {
	Pointer     apijson.Field
	raw         string
	ExtraFields map[string]apijson.Field
}

func (r *DNSSECDeleteResponseEnvelopeMessagesSource) UnmarshalJSON(data []byte) (err error) {
	return apijson.UnmarshalRoot(data, r)
}

func (r dnssecDeleteResponseEnvelopeMessagesSourceJSON) RawJSON() string {
	return r.raw
}

// Whether the API call was successful.
type DNSSECDeleteResponseEnvelopeSuccess bool

const (
	DNSSECDeleteResponseEnvelopeSuccessTrue DNSSECDeleteResponseEnvelopeSuccess = true
)

func (r DNSSECDeleteResponseEnvelopeSuccess) IsKnown() bool {
	switch r {
	case DNSSECDeleteResponseEnvelopeSuccessTrue:
		return true
	}
	return false
}

type DNSSECEditParams struct {
	// Identifier.
	ZoneID param.Field[string] `path:"zone_id,required"`
	// If true, multi-signer DNSSEC is enabled on the zone, allowing multiple providers
	// to serve a DNSSEC-signed zone at the same time. This is required for DNSKEY
	// records (except those automatically generated by Cloudflare) to be added to the
	// zone.
	//
	// See
	// [Multi-signer DNSSEC](https://developers.cloudflare.com/dns/dnssec/multi-signer-dnssec/)
	// for details.
	DNSSECMultiSigner param.Field[bool] `json:"dnssec_multi_signer"`
	// If true, allows Cloudflare to transfer in a DNSSEC-signed zone including
	// signatures from an external provider, without requiring Cloudflare to sign any
	// records on the fly.
	//
	// Note that this feature has some limitations. See
	// [Cloudflare as Secondary](https://developers.cloudflare.com/dns/zone-setups/zone-transfers/cloudflare-as-secondary/setup/#dnssec)
	// for details.
	DNSSECPresigned param.Field[bool] `json:"dnssec_presigned"`
	// If true, enables the use of NSEC3 together with DNSSEC on the zone. Combined
	// with setting dnssec_presigned to true, this enables the use of NSEC3 records
	// when transferring in from an external provider. If dnssec_presigned is instead
	// set to false (default), NSEC3 records will be generated and signed at request
	// time.
	//
	// See
	// [DNSSEC with NSEC3](https://developers.cloudflare.com/dns/dnssec/enable-nsec3/)
	// for details.
	DNSSECUseNsec3 param.Field[bool] `json:"dnssec_use_nsec3"`
	// Status of DNSSEC, based on user-desired state and presence of necessary records.
	Status param.Field[DNSSECEditParamsStatus] `json:"status"`
}

func (r DNSSECEditParams) MarshalJSON() (data []byte, err error) {
	return apijson.MarshalRoot(r)
}

// Status of DNSSEC, based on user-desired state and presence of necessary records.
type DNSSECEditParamsStatus string

const (
	DNSSECEditParamsStatusActive   DNSSECEditParamsStatus = "active"
	DNSSECEditParamsStatusDisabled DNSSECEditParamsStatus = "disabled"
)

func (r DNSSECEditParamsStatus) IsKnown() bool {
	switch r {
	case DNSSECEditParamsStatusActive, DNSSECEditParamsStatusDisabled:
		return true
	}
	return false
}

type DNSSECEditResponseEnvelope struct {
	Errors   []DNSSECEditResponseEnvelopeErrors   `json:"errors,required"`
	Messages []DNSSECEditResponseEnvelopeMessages `json:"messages,required"`
	// Whether the API call was successful.
	Success DNSSECEditResponseEnvelopeSuccess `json:"success,required"`
	Result  DNSSEC                            `json:"result"`
	JSON    dnssecEditResponseEnvelopeJSON    `json:"-"`
}

// dnssecEditResponseEnvelopeJSON contains the JSON metadata for the struct
// [DNSSECEditResponseEnvelope]
type dnssecEditResponseEnvelopeJSON struct {
	Errors      apijson.Field
	Messages    apijson.Field
	Success     apijson.Field
	Result      apijson.Field
	raw         string
	ExtraFields map[string]apijson.Field
}

func (r *DNSSECEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
	return apijson.UnmarshalRoot(data, r)
}

func (r dnssecEditResponseEnvelopeJSON) RawJSON() string {
	return r.raw
}

type DNSSECEditResponseEnvelopeErrors struct {
	Code             int64                                  `json:"code,required"`
	Message          string                                 `json:"message,required"`
	DocumentationURL string                                 `json:"documentation_url"`
	Source           DNSSECEditResponseEnvelopeErrorsSource `json:"source"`
	JSON             dnssecEditResponseEnvelopeErrorsJSON   `json:"-"`
}

// dnssecEditResponseEnvelopeErrorsJSON contains the JSON metadata for the struct
// [DNSSECEditResponseEnvelopeErrors]
type dnssecEditResponseEnvelopeErrorsJSON struct {
	Code             apijson.Field
	Message          apijson.Field
	DocumentationURL apijson.Field
	Source           apijson.Field
	raw              string
	ExtraFields      map[string]apijson.Field
}

func (r *DNSSECEditResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) {
	return apijson.UnmarshalRoot(data, r)
}

func (r dnssecEditResponseEnvelopeErrorsJSON) RawJSON() string {
	return r.raw
}

type DNSSECEditResponseEnvelopeErrorsSource struct {
	Pointer string                                     `json:"pointer"`
	JSON    dnssecEditResponseEnvelopeErrorsSourceJSON `json:"-"`
}

// dnssecEditResponseEnvelopeErrorsSourceJSON contains the JSON metadata for the
// struct [DNSSECEditResponseEnvelopeErrorsSource]
type dnssecEditResponseEnvelopeErrorsSourceJSON struct {
	Pointer     apijson.Field
	raw         string
	ExtraFields map[string]apijson.Field
}

func (r *DNSSECEditResponseEnvelopeErrorsSource) UnmarshalJSON(data []byte) (err error) {
	return apijson.UnmarshalRoot(data, r)
}

func (r dnssecEditResponseEnvelopeErrorsSourceJSON) RawJSON() string {
	return r.raw
}

type DNSSECEditResponseEnvelopeMessages struct {
	Code             int64                                    `json:"code,required"`
	Message          string                                   `json:"message,required"`
	DocumentationURL string                                   `json:"documentation_url"`
	Source           DNSSECEditResponseEnvelopeMessagesSource `json:"source"`
	JSON             dnssecEditResponseEnvelopeMessagesJSON   `json:"-"`
}

// dnssecEditResponseEnvelopeMessagesJSON contains the JSON metadata for the struct
// [DNSSECEditResponseEnvelopeMessages]
type dnssecEditResponseEnvelopeMessagesJSON struct {
	Code             apijson.Field
	Message          apijson.Field
	DocumentationURL apijson.Field
	Source           apijson.Field
	raw              string
	ExtraFields      map[string]apijson.Field
}

func (r *DNSSECEditResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) {
	return apijson.UnmarshalRoot(data, r)
}

func (r dnssecEditResponseEnvelopeMessagesJSON) RawJSON() string {
	return r.raw
}

type DNSSECEditResponseEnvelopeMessagesSource struct {
	Pointer string                                       `json:"pointer"`
	JSON    dnssecEditResponseEnvelopeMessagesSourceJSON `json:"-"`
}

// dnssecEditResponseEnvelopeMessagesSourceJSON contains the JSON metadata for the
// struct [DNSSECEditResponseEnvelopeMessagesSource]
type dnssecEditResponseEnvelopeMessagesSourceJSON struct {
	Pointer     apijson.Field
	raw         string
	ExtraFields map[string]apijson.Field
}

func (r *DNSSECEditResponseEnvelopeMessagesSource) UnmarshalJSON(data []byte) (err error) {
	return apijson.UnmarshalRoot(data, r)
}

func (r dnssecEditResponseEnvelopeMessagesSourceJSON) RawJSON() string {
	return r.raw
}

// Whether the API call was successful.
type DNSSECEditResponseEnvelopeSuccess bool

const (
	DNSSECEditResponseEnvelopeSuccessTrue DNSSECEditResponseEnvelopeSuccess = true
)

func (r DNSSECEditResponseEnvelopeSuccess) IsKnown() bool {
	switch r {
	case DNSSECEditResponseEnvelopeSuccessTrue:
		return true
	}
	return false
}

type DNSSECGetParams struct {
	// Identifier.
	ZoneID param.Field[string] `path:"zone_id,required"`
}

type DNSSECGetResponseEnvelope struct {
	Errors   []DNSSECGetResponseEnvelopeErrors   `json:"errors,required"`
	Messages []DNSSECGetResponseEnvelopeMessages `json:"messages,required"`
	// Whether the API call was successful.
	Success DNSSECGetResponseEnvelopeSuccess `json:"success,required"`
	Result  DNSSEC                           `json:"result"`
	JSON    dnssecGetResponseEnvelopeJSON    `json:"-"`
}

// dnssecGetResponseEnvelopeJSON contains the JSON metadata for the struct
// [DNSSECGetResponseEnvelope]
type dnssecGetResponseEnvelopeJSON struct {
	Errors      apijson.Field
	Messages    apijson.Field
	Success     apijson.Field
	Result      apijson.Field
	raw         string
	ExtraFields map[string]apijson.Field
}

func (r *DNSSECGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
	return apijson.UnmarshalRoot(data, r)
}

func (r dnssecGetResponseEnvelopeJSON) RawJSON() string {
	return r.raw
}

type DNSSECGetResponseEnvelopeErrors struct {
	Code             int64                                 `json:"code,required"`
	Message          string                                `json:"message,required"`
	DocumentationURL string                                `json:"documentation_url"`
	Source           DNSSECGetResponseEnvelopeErrorsSource `json:"source"`
	JSON             dnssecGetResponseEnvelopeErrorsJSON   `json:"-"`
}

// dnssecGetResponseEnvelopeErrorsJSON contains the JSON metadata for the struct
// [DNSSECGetResponseEnvelopeErrors]
type dnssecGetResponseEnvelopeErrorsJSON struct {
	Code             apijson.Field
	Message          apijson.Field
	DocumentationURL apijson.Field
	Source           apijson.Field
	raw              string
	ExtraFields      map[string]apijson.Field
}

func (r *DNSSECGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) {
	return apijson.UnmarshalRoot(data, r)
}

func (r dnssecGetResponseEnvelopeErrorsJSON) RawJSON() string {
	return r.raw
}

type DNSSECGetResponseEnvelopeErrorsSource struct {
	Pointer string                                    `json:"pointer"`
	JSON    dnssecGetResponseEnvelopeErrorsSourceJSON `json:"-"`
}

// dnssecGetResponseEnvelopeErrorsSourceJSON contains the JSON metadata for the
// struct [DNSSECGetResponseEnvelopeErrorsSource]
type dnssecGetResponseEnvelopeErrorsSourceJSON struct {
	Pointer     apijson.Field
	raw         string
	ExtraFields map[string]apijson.Field
}

func (r *DNSSECGetResponseEnvelopeErrorsSource) UnmarshalJSON(data []byte) (err error) {
	return apijson.UnmarshalRoot(data, r)
}

func (r dnssecGetResponseEnvelopeErrorsSourceJSON) RawJSON() string {
	return r.raw
}

type DNSSECGetResponseEnvelopeMessages struct {
	Code             int64                                   `json:"code,required"`
	Message          string                                  `json:"message,required"`
	DocumentationURL string                                  `json:"documentation_url"`
	Source           DNSSECGetResponseEnvelopeMessagesSource `json:"source"`
	JSON             dnssecGetResponseEnvelopeMessagesJSON   `json:"-"`
}

// dnssecGetResponseEnvelopeMessagesJSON contains the JSON metadata for the struct
// [DNSSECGetResponseEnvelopeMessages]
type dnssecGetResponseEnvelopeMessagesJSON struct {
	Code             apijson.Field
	Message          apijson.Field
	DocumentationURL apijson.Field
	Source           apijson.Field
	raw              string
	ExtraFields      map[string]apijson.Field
}

func (r *DNSSECGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) {
	return apijson.UnmarshalRoot(data, r)
}

func (r dnssecGetResponseEnvelopeMessagesJSON) RawJSON() string {
	return r.raw
}

type DNSSECGetResponseEnvelopeMessagesSource struct {
	Pointer string                                      `json:"pointer"`
	JSON    dnssecGetResponseEnvelopeMessagesSourceJSON `json:"-"`
}

// dnssecGetResponseEnvelopeMessagesSourceJSON contains the JSON metadata for the
// struct [DNSSECGetResponseEnvelopeMessagesSource]
type dnssecGetResponseEnvelopeMessagesSourceJSON struct {
	Pointer     apijson.Field
	raw         string
	ExtraFields map[string]apijson.Field
}

func (r *DNSSECGetResponseEnvelopeMessagesSource) UnmarshalJSON(data []byte) (err error) {
	return apijson.UnmarshalRoot(data, r)
}

func (r dnssecGetResponseEnvelopeMessagesSourceJSON) RawJSON() string {
	return r.raw
}

// Whether the API call was successful.
type DNSSECGetResponseEnvelopeSuccess bool

const (
	DNSSECGetResponseEnvelopeSuccessTrue DNSSECGetResponseEnvelopeSuccess = true
)

func (r DNSSECGetResponseEnvelopeSuccess) IsKnown() bool {
	switch r {
	case DNSSECGetResponseEnvelopeSuccessTrue:
		return true
	}
	return false
}
