// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.

package shared

import (
	"encoding/json"
	"errors"
	"fmt"
	"github.com/airbytehq/terraform-provider-airbyte/internal/sdk/internal/utils"
	"time"
)

type SourceSharepointEnterpriseUpdateSchemasAuthType string

const (
	SourceSharepointEnterpriseUpdateSchemasAuthTypeService SourceSharepointEnterpriseUpdateSchemasAuthType = "Service"
)

func (e SourceSharepointEnterpriseUpdateSchemasAuthType) ToPointer() *SourceSharepointEnterpriseUpdateSchemasAuthType {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateSchemasAuthType) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "Service":
		*e = SourceSharepointEnterpriseUpdateSchemasAuthType(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateSchemasAuthType: %v", v)
	}
}

// SourceSharepointEnterpriseUpdateServiceKeyAuthentication - ServiceCredentials class for service key authentication.
// This class is structured similarly to OAuthCredentials but for a different authentication method.
type SourceSharepointEnterpriseUpdateServiceKeyAuthentication struct {
	authType *SourceSharepointEnterpriseUpdateSchemasAuthType `const:"Service" json:"auth_type"`
	// Client ID of your Microsoft developer application
	ClientID string `json:"client_id"`
	// Client Secret of your Microsoft developer application
	ClientSecret string `json:"client_secret"`
	// Tenant ID of the Microsoft SharePoint user
	TenantID string `json:"tenant_id"`
	// Special characters such as a period, comma, space, and the at sign (@) are converted to underscores (_). More details: https://learn.microsoft.com/en-us/sharepoint/list-onedrive-urls
	UserPrincipalName string `json:"user_principal_name"`
}

func (s SourceSharepointEnterpriseUpdateServiceKeyAuthentication) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceSharepointEnterpriseUpdateServiceKeyAuthentication) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *SourceSharepointEnterpriseUpdateServiceKeyAuthentication) GetAuthType() *SourceSharepointEnterpriseUpdateSchemasAuthType {
	return SourceSharepointEnterpriseUpdateSchemasAuthTypeService.ToPointer()
}

func (o *SourceSharepointEnterpriseUpdateServiceKeyAuthentication) GetClientID() string {
	if o == nil {
		return ""
	}
	return o.ClientID
}

func (o *SourceSharepointEnterpriseUpdateServiceKeyAuthentication) GetClientSecret() string {
	if o == nil {
		return ""
	}
	return o.ClientSecret
}

func (o *SourceSharepointEnterpriseUpdateServiceKeyAuthentication) GetTenantID() string {
	if o == nil {
		return ""
	}
	return o.TenantID
}

func (o *SourceSharepointEnterpriseUpdateServiceKeyAuthentication) GetUserPrincipalName() string {
	if o == nil {
		return ""
	}
	return o.UserPrincipalName
}

type SourceSharepointEnterpriseUpdateAuthType string

const (
	SourceSharepointEnterpriseUpdateAuthTypeClient SourceSharepointEnterpriseUpdateAuthType = "Client"
)

func (e SourceSharepointEnterpriseUpdateAuthType) ToPointer() *SourceSharepointEnterpriseUpdateAuthType {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateAuthType) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "Client":
		*e = SourceSharepointEnterpriseUpdateAuthType(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateAuthType: %v", v)
	}
}

// SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth - OAuthCredentials class to hold authentication details for Microsoft OAuth authentication.
// This class uses pydantic for data validation and settings management.
type SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth struct {
	authType *SourceSharepointEnterpriseUpdateAuthType `const:"Client" json:"auth_type"`
	// Client ID of your Microsoft developer application
	ClientID string `json:"client_id"`
	// Client Secret of your Microsoft developer application
	ClientSecret string `json:"client_secret"`
	// Refresh Token of your Microsoft developer application
	RefreshToken *string `json:"refresh_token,omitempty"`
	// Tenant ID of the Microsoft SharePoint user
	TenantID string `json:"tenant_id"`
}

func (s SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth) GetAuthType() *SourceSharepointEnterpriseUpdateAuthType {
	return SourceSharepointEnterpriseUpdateAuthTypeClient.ToPointer()
}

func (o *SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth) GetClientID() string {
	if o == nil {
		return ""
	}
	return o.ClientID
}

func (o *SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth) GetClientSecret() string {
	if o == nil {
		return ""
	}
	return o.ClientSecret
}

func (o *SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth) GetRefreshToken() *string {
	if o == nil {
		return nil
	}
	return o.RefreshToken
}

func (o *SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth) GetTenantID() string {
	if o == nil {
		return ""
	}
	return o.TenantID
}

type SourceSharepointEnterpriseUpdateAuthenticationType string

const (
	SourceSharepointEnterpriseUpdateAuthenticationTypeSourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth SourceSharepointEnterpriseUpdateAuthenticationType = "source-sharepoint-enterprise-update_Authenticate via Microsoft (OAuth)"
	SourceSharepointEnterpriseUpdateAuthenticationTypeSourceSharepointEnterpriseUpdateServiceKeyAuthentication      SourceSharepointEnterpriseUpdateAuthenticationType = "source-sharepoint-enterprise-update_Service Key Authentication"
)

// SourceSharepointEnterpriseUpdateAuthentication - Credentials for connecting to the One Drive API
type SourceSharepointEnterpriseUpdateAuthentication struct {
	SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth *SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth `queryParam:"inline"`
	SourceSharepointEnterpriseUpdateServiceKeyAuthentication      *SourceSharepointEnterpriseUpdateServiceKeyAuthentication      `queryParam:"inline"`

	Type SourceSharepointEnterpriseUpdateAuthenticationType
}

func CreateSourceSharepointEnterpriseUpdateAuthenticationSourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth(sourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth) SourceSharepointEnterpriseUpdateAuthentication {
	typ := SourceSharepointEnterpriseUpdateAuthenticationTypeSourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth

	return SourceSharepointEnterpriseUpdateAuthentication{
		SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth: &sourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth,
		Type: typ,
	}
}

func CreateSourceSharepointEnterpriseUpdateAuthenticationSourceSharepointEnterpriseUpdateServiceKeyAuthentication(sourceSharepointEnterpriseUpdateServiceKeyAuthentication SourceSharepointEnterpriseUpdateServiceKeyAuthentication) SourceSharepointEnterpriseUpdateAuthentication {
	typ := SourceSharepointEnterpriseUpdateAuthenticationTypeSourceSharepointEnterpriseUpdateServiceKeyAuthentication

	return SourceSharepointEnterpriseUpdateAuthentication{
		SourceSharepointEnterpriseUpdateServiceKeyAuthentication: &sourceSharepointEnterpriseUpdateServiceKeyAuthentication,
		Type: typ,
	}
}

func (u *SourceSharepointEnterpriseUpdateAuthentication) UnmarshalJSON(data []byte) error {

	var sourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth = SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth{}
	if err := utils.UnmarshalJSON(data, &sourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth, "", true, true); err == nil {
		u.SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth = &sourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth
		u.Type = SourceSharepointEnterpriseUpdateAuthenticationTypeSourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth
		return nil
	}

	var sourceSharepointEnterpriseUpdateServiceKeyAuthentication SourceSharepointEnterpriseUpdateServiceKeyAuthentication = SourceSharepointEnterpriseUpdateServiceKeyAuthentication{}
	if err := utils.UnmarshalJSON(data, &sourceSharepointEnterpriseUpdateServiceKeyAuthentication, "", true, true); err == nil {
		u.SourceSharepointEnterpriseUpdateServiceKeyAuthentication = &sourceSharepointEnterpriseUpdateServiceKeyAuthentication
		u.Type = SourceSharepointEnterpriseUpdateAuthenticationTypeSourceSharepointEnterpriseUpdateServiceKeyAuthentication
		return nil
	}

	return fmt.Errorf("could not unmarshal `%s` into any supported union types for SourceSharepointEnterpriseUpdateAuthentication", string(data))
}

func (u SourceSharepointEnterpriseUpdateAuthentication) MarshalJSON() ([]byte, error) {
	if u.SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth != nil {
		return utils.MarshalJSON(u.SourceSharepointEnterpriseUpdateAuthenticateViaMicrosoftOAuth, "", true)
	}

	if u.SourceSharepointEnterpriseUpdateServiceKeyAuthentication != nil {
		return utils.MarshalJSON(u.SourceSharepointEnterpriseUpdateServiceKeyAuthentication, "", true)
	}

	return nil, errors.New("could not marshal union type SourceSharepointEnterpriseUpdateAuthentication: all fields are null")
}

type SourceSharepointEnterpriseUpdateSchemasDeliveryMethodDeliveryType string

const (
	SourceSharepointEnterpriseUpdateSchemasDeliveryMethodDeliveryTypeUsePermissionsTransfer SourceSharepointEnterpriseUpdateSchemasDeliveryMethodDeliveryType = "use_permissions_transfer"
)

func (e SourceSharepointEnterpriseUpdateSchemasDeliveryMethodDeliveryType) ToPointer() *SourceSharepointEnterpriseUpdateSchemasDeliveryMethodDeliveryType {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateSchemasDeliveryMethodDeliveryType) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "use_permissions_transfer":
		*e = SourceSharepointEnterpriseUpdateSchemasDeliveryMethodDeliveryType(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateSchemasDeliveryMethodDeliveryType: %v", v)
	}
}

// SourceSharepointEnterpriseUpdateReplicatePermissionsACL - Sends one identity stream and one for more permissions (ACL) streams to the destination. This data can be used in downstream systems to recreate permission restrictions mirroring the original source.
type SourceSharepointEnterpriseUpdateReplicatePermissionsACL struct {
	deliveryType *SourceSharepointEnterpriseUpdateSchemasDeliveryMethodDeliveryType `const:"use_permissions_transfer" json:"delivery_type"`
	// This data can be used in downstream systems to recreate permission restrictions mirroring the original source
	IncludeIdentitiesStream *bool `default:"true" json:"include_identities_stream"`
}

func (s SourceSharepointEnterpriseUpdateReplicatePermissionsACL) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceSharepointEnterpriseUpdateReplicatePermissionsACL) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *SourceSharepointEnterpriseUpdateReplicatePermissionsACL) GetDeliveryType() *SourceSharepointEnterpriseUpdateSchemasDeliveryMethodDeliveryType {
	return SourceSharepointEnterpriseUpdateSchemasDeliveryMethodDeliveryTypeUsePermissionsTransfer.ToPointer()
}

func (o *SourceSharepointEnterpriseUpdateReplicatePermissionsACL) GetIncludeIdentitiesStream() *bool {
	if o == nil {
		return nil
	}
	return o.IncludeIdentitiesStream
}

type SourceSharepointEnterpriseUpdateSchemasDeliveryType string

const (
	SourceSharepointEnterpriseUpdateSchemasDeliveryTypeUseFileTransfer SourceSharepointEnterpriseUpdateSchemasDeliveryType = "use_file_transfer"
)

func (e SourceSharepointEnterpriseUpdateSchemasDeliveryType) ToPointer() *SourceSharepointEnterpriseUpdateSchemasDeliveryType {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateSchemasDeliveryType) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "use_file_transfer":
		*e = SourceSharepointEnterpriseUpdateSchemasDeliveryType(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateSchemasDeliveryType: %v", v)
	}
}

// SourceSharepointEnterpriseUpdateCopyRawFiles - Copy raw files without parsing their contents. Bits are copied into the destination exactly as they appeared in the source. Recommended for use with unstructured text data, non-text and compressed files.
type SourceSharepointEnterpriseUpdateCopyRawFiles struct {
	deliveryType *SourceSharepointEnterpriseUpdateSchemasDeliveryType `const:"use_file_transfer" json:"delivery_type"`
	// If enabled, sends subdirectory folder structure along with source file names to the destination. Otherwise, files will be synced by their names only. This option is ignored when file-based replication is not enabled.
	PreserveDirectoryStructure *bool `default:"true" json:"preserve_directory_structure"`
}

func (s SourceSharepointEnterpriseUpdateCopyRawFiles) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceSharepointEnterpriseUpdateCopyRawFiles) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *SourceSharepointEnterpriseUpdateCopyRawFiles) GetDeliveryType() *SourceSharepointEnterpriseUpdateSchemasDeliveryType {
	return SourceSharepointEnterpriseUpdateSchemasDeliveryTypeUseFileTransfer.ToPointer()
}

func (o *SourceSharepointEnterpriseUpdateCopyRawFiles) GetPreserveDirectoryStructure() *bool {
	if o == nil {
		return nil
	}
	return o.PreserveDirectoryStructure
}

type SourceSharepointEnterpriseUpdateDeliveryType string

const (
	SourceSharepointEnterpriseUpdateDeliveryTypeUseRecordsTransfer SourceSharepointEnterpriseUpdateDeliveryType = "use_records_transfer"
)

func (e SourceSharepointEnterpriseUpdateDeliveryType) ToPointer() *SourceSharepointEnterpriseUpdateDeliveryType {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateDeliveryType) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "use_records_transfer":
		*e = SourceSharepointEnterpriseUpdateDeliveryType(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateDeliveryType: %v", v)
	}
}

// SourceSharepointEnterpriseUpdateReplicateRecords - Recommended - Extract and load structured records into your destination of choice. This is the classic method of moving data in Airbyte. It allows for blocking and hashing individual fields or files from a structured schema. Data can be flattened, typed and deduped depending on the destination.
type SourceSharepointEnterpriseUpdateReplicateRecords struct {
	deliveryType *SourceSharepointEnterpriseUpdateDeliveryType `const:"use_records_transfer" json:"delivery_type"`
}

func (s SourceSharepointEnterpriseUpdateReplicateRecords) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceSharepointEnterpriseUpdateReplicateRecords) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *SourceSharepointEnterpriseUpdateReplicateRecords) GetDeliveryType() *SourceSharepointEnterpriseUpdateDeliveryType {
	return SourceSharepointEnterpriseUpdateDeliveryTypeUseRecordsTransfer.ToPointer()
}

type SourceSharepointEnterpriseUpdateDeliveryMethodType string

const (
	SourceSharepointEnterpriseUpdateDeliveryMethodTypeSourceSharepointEnterpriseUpdateReplicateRecords        SourceSharepointEnterpriseUpdateDeliveryMethodType = "source-sharepoint-enterprise-update_Replicate Records"
	SourceSharepointEnterpriseUpdateDeliveryMethodTypeSourceSharepointEnterpriseUpdateCopyRawFiles            SourceSharepointEnterpriseUpdateDeliveryMethodType = "source-sharepoint-enterprise-update_Copy Raw Files"
	SourceSharepointEnterpriseUpdateDeliveryMethodTypeSourceSharepointEnterpriseUpdateReplicatePermissionsACL SourceSharepointEnterpriseUpdateDeliveryMethodType = "source-sharepoint-enterprise-update_Replicate Permissions ACL"
)

type SourceSharepointEnterpriseUpdateDeliveryMethod struct {
	SourceSharepointEnterpriseUpdateReplicateRecords        *SourceSharepointEnterpriseUpdateReplicateRecords        `queryParam:"inline"`
	SourceSharepointEnterpriseUpdateCopyRawFiles            *SourceSharepointEnterpriseUpdateCopyRawFiles            `queryParam:"inline"`
	SourceSharepointEnterpriseUpdateReplicatePermissionsACL *SourceSharepointEnterpriseUpdateReplicatePermissionsACL `queryParam:"inline"`

	Type SourceSharepointEnterpriseUpdateDeliveryMethodType
}

func CreateSourceSharepointEnterpriseUpdateDeliveryMethodSourceSharepointEnterpriseUpdateReplicateRecords(sourceSharepointEnterpriseUpdateReplicateRecords SourceSharepointEnterpriseUpdateReplicateRecords) SourceSharepointEnterpriseUpdateDeliveryMethod {
	typ := SourceSharepointEnterpriseUpdateDeliveryMethodTypeSourceSharepointEnterpriseUpdateReplicateRecords

	return SourceSharepointEnterpriseUpdateDeliveryMethod{
		SourceSharepointEnterpriseUpdateReplicateRecords: &sourceSharepointEnterpriseUpdateReplicateRecords,
		Type: typ,
	}
}

func CreateSourceSharepointEnterpriseUpdateDeliveryMethodSourceSharepointEnterpriseUpdateCopyRawFiles(sourceSharepointEnterpriseUpdateCopyRawFiles SourceSharepointEnterpriseUpdateCopyRawFiles) SourceSharepointEnterpriseUpdateDeliveryMethod {
	typ := SourceSharepointEnterpriseUpdateDeliveryMethodTypeSourceSharepointEnterpriseUpdateCopyRawFiles

	return SourceSharepointEnterpriseUpdateDeliveryMethod{
		SourceSharepointEnterpriseUpdateCopyRawFiles: &sourceSharepointEnterpriseUpdateCopyRawFiles,
		Type: typ,
	}
}

func CreateSourceSharepointEnterpriseUpdateDeliveryMethodSourceSharepointEnterpriseUpdateReplicatePermissionsACL(sourceSharepointEnterpriseUpdateReplicatePermissionsACL SourceSharepointEnterpriseUpdateReplicatePermissionsACL) SourceSharepointEnterpriseUpdateDeliveryMethod {
	typ := SourceSharepointEnterpriseUpdateDeliveryMethodTypeSourceSharepointEnterpriseUpdateReplicatePermissionsACL

	return SourceSharepointEnterpriseUpdateDeliveryMethod{
		SourceSharepointEnterpriseUpdateReplicatePermissionsACL: &sourceSharepointEnterpriseUpdateReplicatePermissionsACL,
		Type: typ,
	}
}

func (u *SourceSharepointEnterpriseUpdateDeliveryMethod) UnmarshalJSON(data []byte) error {

	var sourceSharepointEnterpriseUpdateReplicateRecords SourceSharepointEnterpriseUpdateReplicateRecords = SourceSharepointEnterpriseUpdateReplicateRecords{}
	if err := utils.UnmarshalJSON(data, &sourceSharepointEnterpriseUpdateReplicateRecords, "", true, true); err == nil {
		u.SourceSharepointEnterpriseUpdateReplicateRecords = &sourceSharepointEnterpriseUpdateReplicateRecords
		u.Type = SourceSharepointEnterpriseUpdateDeliveryMethodTypeSourceSharepointEnterpriseUpdateReplicateRecords
		return nil
	}

	var sourceSharepointEnterpriseUpdateCopyRawFiles SourceSharepointEnterpriseUpdateCopyRawFiles = SourceSharepointEnterpriseUpdateCopyRawFiles{}
	if err := utils.UnmarshalJSON(data, &sourceSharepointEnterpriseUpdateCopyRawFiles, "", true, true); err == nil {
		u.SourceSharepointEnterpriseUpdateCopyRawFiles = &sourceSharepointEnterpriseUpdateCopyRawFiles
		u.Type = SourceSharepointEnterpriseUpdateDeliveryMethodTypeSourceSharepointEnterpriseUpdateCopyRawFiles
		return nil
	}

	var sourceSharepointEnterpriseUpdateReplicatePermissionsACL SourceSharepointEnterpriseUpdateReplicatePermissionsACL = SourceSharepointEnterpriseUpdateReplicatePermissionsACL{}
	if err := utils.UnmarshalJSON(data, &sourceSharepointEnterpriseUpdateReplicatePermissionsACL, "", true, true); err == nil {
		u.SourceSharepointEnterpriseUpdateReplicatePermissionsACL = &sourceSharepointEnterpriseUpdateReplicatePermissionsACL
		u.Type = SourceSharepointEnterpriseUpdateDeliveryMethodTypeSourceSharepointEnterpriseUpdateReplicatePermissionsACL
		return nil
	}

	return fmt.Errorf("could not unmarshal `%s` into any supported union types for SourceSharepointEnterpriseUpdateDeliveryMethod", string(data))
}

func (u SourceSharepointEnterpriseUpdateDeliveryMethod) MarshalJSON() ([]byte, error) {
	if u.SourceSharepointEnterpriseUpdateReplicateRecords != nil {
		return utils.MarshalJSON(u.SourceSharepointEnterpriseUpdateReplicateRecords, "", true)
	}

	if u.SourceSharepointEnterpriseUpdateCopyRawFiles != nil {
		return utils.MarshalJSON(u.SourceSharepointEnterpriseUpdateCopyRawFiles, "", true)
	}

	if u.SourceSharepointEnterpriseUpdateReplicatePermissionsACL != nil {
		return utils.MarshalJSON(u.SourceSharepointEnterpriseUpdateReplicatePermissionsACL, "", true)
	}

	return nil, errors.New("could not marshal union type SourceSharepointEnterpriseUpdateDeliveryMethod: all fields are null")
}

// SourceSharepointEnterpriseUpdateSearchScope - Specifies the location(s) to search for files. Valid options are 'ACCESSIBLE_DRIVES' for all SharePoint drives the user can access, 'SHARED_ITEMS' for shared items the user has access to, and 'ALL' to search both.
type SourceSharepointEnterpriseUpdateSearchScope string

const (
	SourceSharepointEnterpriseUpdateSearchScopeAccessibleDrives SourceSharepointEnterpriseUpdateSearchScope = "ACCESSIBLE_DRIVES"
	SourceSharepointEnterpriseUpdateSearchScopeSharedItems      SourceSharepointEnterpriseUpdateSearchScope = "SHARED_ITEMS"
	SourceSharepointEnterpriseUpdateSearchScopeAll              SourceSharepointEnterpriseUpdateSearchScope = "ALL"
)

func (e SourceSharepointEnterpriseUpdateSearchScope) ToPointer() *SourceSharepointEnterpriseUpdateSearchScope {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateSearchScope) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "ACCESSIBLE_DRIVES":
		fallthrough
	case "SHARED_ITEMS":
		fallthrough
	case "ALL":
		*e = SourceSharepointEnterpriseUpdateSearchScope(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateSearchScope: %v", v)
	}
}

type SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormat6Filetype string

const (
	SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormat6FiletypeExcel SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormat6Filetype = "excel"
)

func (e SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormat6Filetype) ToPointer() *SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormat6Filetype {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormat6Filetype) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "excel":
		*e = SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormat6Filetype(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormat6Filetype: %v", v)
	}
}

type SourceSharepointEnterpriseUpdateExcelFormat struct {
	filetype *SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormat6Filetype `const:"excel" json:"filetype"`
}

func (s SourceSharepointEnterpriseUpdateExcelFormat) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceSharepointEnterpriseUpdateExcelFormat) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *SourceSharepointEnterpriseUpdateExcelFormat) GetFiletype() *SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormat6Filetype {
	return SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormat6FiletypeExcel.ToPointer()
}

type SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormatFiletype string

const (
	SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormatFiletypeUnstructured SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormatFiletype = "unstructured"
)

func (e SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormatFiletype) ToPointer() *SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormatFiletype {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormatFiletype) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "unstructured":
		*e = SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormatFiletype(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormatFiletype: %v", v)
	}
}

type SourceSharepointEnterpriseUpdateMode string

const (
	SourceSharepointEnterpriseUpdateModeLocal SourceSharepointEnterpriseUpdateMode = "local"
)

func (e SourceSharepointEnterpriseUpdateMode) ToPointer() *SourceSharepointEnterpriseUpdateMode {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateMode) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "local":
		*e = SourceSharepointEnterpriseUpdateMode(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateMode: %v", v)
	}
}

// SourceSharepointEnterpriseUpdateLocal - Process files locally, supporting `fast` and `ocr` modes. This is the default option.
type SourceSharepointEnterpriseUpdateLocal struct {
	mode *SourceSharepointEnterpriseUpdateMode `const:"local" json:"mode"`
}

func (s SourceSharepointEnterpriseUpdateLocal) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceSharepointEnterpriseUpdateLocal) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *SourceSharepointEnterpriseUpdateLocal) GetMode() *SourceSharepointEnterpriseUpdateMode {
	return SourceSharepointEnterpriseUpdateModeLocal.ToPointer()
}

type SourceSharepointEnterpriseUpdateProcessingType string

const (
	SourceSharepointEnterpriseUpdateProcessingTypeSourceSharepointEnterpriseUpdateLocal SourceSharepointEnterpriseUpdateProcessingType = "source-sharepoint-enterprise-update_Local"
)

// SourceSharepointEnterpriseUpdateProcessing - Processing configuration
type SourceSharepointEnterpriseUpdateProcessing struct {
	SourceSharepointEnterpriseUpdateLocal *SourceSharepointEnterpriseUpdateLocal `queryParam:"inline"`

	Type SourceSharepointEnterpriseUpdateProcessingType
}

func CreateSourceSharepointEnterpriseUpdateProcessingSourceSharepointEnterpriseUpdateLocal(sourceSharepointEnterpriseUpdateLocal SourceSharepointEnterpriseUpdateLocal) SourceSharepointEnterpriseUpdateProcessing {
	typ := SourceSharepointEnterpriseUpdateProcessingTypeSourceSharepointEnterpriseUpdateLocal

	return SourceSharepointEnterpriseUpdateProcessing{
		SourceSharepointEnterpriseUpdateLocal: &sourceSharepointEnterpriseUpdateLocal,
		Type:                                  typ,
	}
}

func (u *SourceSharepointEnterpriseUpdateProcessing) UnmarshalJSON(data []byte) error {

	var sourceSharepointEnterpriseUpdateLocal SourceSharepointEnterpriseUpdateLocal = SourceSharepointEnterpriseUpdateLocal{}
	if err := utils.UnmarshalJSON(data, &sourceSharepointEnterpriseUpdateLocal, "", true, true); err == nil {
		u.SourceSharepointEnterpriseUpdateLocal = &sourceSharepointEnterpriseUpdateLocal
		u.Type = SourceSharepointEnterpriseUpdateProcessingTypeSourceSharepointEnterpriseUpdateLocal
		return nil
	}

	return fmt.Errorf("could not unmarshal `%s` into any supported union types for SourceSharepointEnterpriseUpdateProcessing", string(data))
}

func (u SourceSharepointEnterpriseUpdateProcessing) MarshalJSON() ([]byte, error) {
	if u.SourceSharepointEnterpriseUpdateLocal != nil {
		return utils.MarshalJSON(u.SourceSharepointEnterpriseUpdateLocal, "", true)
	}

	return nil, errors.New("could not marshal union type SourceSharepointEnterpriseUpdateProcessing: all fields are null")
}

// SourceSharepointEnterpriseUpdateParsingStrategy - The strategy used to parse documents. `fast` extracts text directly from the document which doesn't work for all files. `ocr_only` is more reliable, but slower. `hi_res` is the most reliable, but requires an API key and a hosted instance of unstructured and can't be used with local mode. See the unstructured.io documentation for more details: https://unstructured-io.github.io/unstructured/core/partition.html#partition-pdf
type SourceSharepointEnterpriseUpdateParsingStrategy string

const (
	SourceSharepointEnterpriseUpdateParsingStrategyAuto    SourceSharepointEnterpriseUpdateParsingStrategy = "auto"
	SourceSharepointEnterpriseUpdateParsingStrategyFast    SourceSharepointEnterpriseUpdateParsingStrategy = "fast"
	SourceSharepointEnterpriseUpdateParsingStrategyOcrOnly SourceSharepointEnterpriseUpdateParsingStrategy = "ocr_only"
	SourceSharepointEnterpriseUpdateParsingStrategyHiRes   SourceSharepointEnterpriseUpdateParsingStrategy = "hi_res"
)

func (e SourceSharepointEnterpriseUpdateParsingStrategy) ToPointer() *SourceSharepointEnterpriseUpdateParsingStrategy {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateParsingStrategy) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "auto":
		fallthrough
	case "fast":
		fallthrough
	case "ocr_only":
		fallthrough
	case "hi_res":
		*e = SourceSharepointEnterpriseUpdateParsingStrategy(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateParsingStrategy: %v", v)
	}
}

// SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat - Extract text from document formats (.pdf, .docx, .md, .pptx) and emit as one record per file.
type SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat struct {
	filetype *SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormatFiletype `const:"unstructured" json:"filetype"`
	// Processing configuration
	Processing *SourceSharepointEnterpriseUpdateProcessing `json:"processing,omitempty"`
	// If true, skip files that cannot be parsed and pass the error message along as the _ab_source_file_parse_error field. If false, fail the sync.
	SkipUnprocessableFiles *bool `default:"true" json:"skip_unprocessable_files"`
	// The strategy used to parse documents. `fast` extracts text directly from the document which doesn't work for all files. `ocr_only` is more reliable, but slower. `hi_res` is the most reliable, but requires an API key and a hosted instance of unstructured and can't be used with local mode. See the unstructured.io documentation for more details: https://unstructured-io.github.io/unstructured/core/partition.html#partition-pdf
	Strategy *SourceSharepointEnterpriseUpdateParsingStrategy `default:"auto" json:"strategy"`
}

func (s SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat) GetFiletype() *SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormatFiletype {
	return SourceSharepointEnterpriseUpdateSchemasStreamsFormatFormatFiletypeUnstructured.ToPointer()
}

func (o *SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat) GetProcessing() *SourceSharepointEnterpriseUpdateProcessing {
	if o == nil {
		return nil
	}
	return o.Processing
}

func (o *SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat) GetSkipUnprocessableFiles() *bool {
	if o == nil {
		return nil
	}
	return o.SkipUnprocessableFiles
}

func (o *SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat) GetStrategy() *SourceSharepointEnterpriseUpdateParsingStrategy {
	if o == nil {
		return nil
	}
	return o.Strategy
}

type SourceSharepointEnterpriseUpdateSchemasStreamsFormatFiletype string

const (
	SourceSharepointEnterpriseUpdateSchemasStreamsFormatFiletypeParquet SourceSharepointEnterpriseUpdateSchemasStreamsFormatFiletype = "parquet"
)

func (e SourceSharepointEnterpriseUpdateSchemasStreamsFormatFiletype) ToPointer() *SourceSharepointEnterpriseUpdateSchemasStreamsFormatFiletype {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateSchemasStreamsFormatFiletype) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "parquet":
		*e = SourceSharepointEnterpriseUpdateSchemasStreamsFormatFiletype(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateSchemasStreamsFormatFiletype: %v", v)
	}
}

type SourceSharepointEnterpriseUpdateParquetFormat struct {
	// Whether to convert decimal fields to floats. There is a loss of precision when converting decimals to floats, so this is not recommended.
	DecimalAsFloat *bool                                                         `default:"false" json:"decimal_as_float"`
	filetype       *SourceSharepointEnterpriseUpdateSchemasStreamsFormatFiletype `const:"parquet" json:"filetype"`
}

func (s SourceSharepointEnterpriseUpdateParquetFormat) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceSharepointEnterpriseUpdateParquetFormat) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *SourceSharepointEnterpriseUpdateParquetFormat) GetDecimalAsFloat() *bool {
	if o == nil {
		return nil
	}
	return o.DecimalAsFloat
}

func (o *SourceSharepointEnterpriseUpdateParquetFormat) GetFiletype() *SourceSharepointEnterpriseUpdateSchemasStreamsFormatFiletype {
	return SourceSharepointEnterpriseUpdateSchemasStreamsFormatFiletypeParquet.ToPointer()
}

type SourceSharepointEnterpriseUpdateSchemasStreamsFiletype string

const (
	SourceSharepointEnterpriseUpdateSchemasStreamsFiletypeJsonl SourceSharepointEnterpriseUpdateSchemasStreamsFiletype = "jsonl"
)

func (e SourceSharepointEnterpriseUpdateSchemasStreamsFiletype) ToPointer() *SourceSharepointEnterpriseUpdateSchemasStreamsFiletype {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateSchemasStreamsFiletype) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "jsonl":
		*e = SourceSharepointEnterpriseUpdateSchemasStreamsFiletype(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateSchemasStreamsFiletype: %v", v)
	}
}

type SourceSharepointEnterpriseUpdateJsonlFormat struct {
	filetype *SourceSharepointEnterpriseUpdateSchemasStreamsFiletype `const:"jsonl" json:"filetype"`
}

func (s SourceSharepointEnterpriseUpdateJsonlFormat) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceSharepointEnterpriseUpdateJsonlFormat) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *SourceSharepointEnterpriseUpdateJsonlFormat) GetFiletype() *SourceSharepointEnterpriseUpdateSchemasStreamsFiletype {
	return SourceSharepointEnterpriseUpdateSchemasStreamsFiletypeJsonl.ToPointer()
}

type SourceSharepointEnterpriseUpdateSchemasFiletype string

const (
	SourceSharepointEnterpriseUpdateSchemasFiletypeCsv SourceSharepointEnterpriseUpdateSchemasFiletype = "csv"
)

func (e SourceSharepointEnterpriseUpdateSchemasFiletype) ToPointer() *SourceSharepointEnterpriseUpdateSchemasFiletype {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateSchemasFiletype) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "csv":
		*e = SourceSharepointEnterpriseUpdateSchemasFiletype(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateSchemasFiletype: %v", v)
	}
}

type SourceSharepointEnterpriseUpdateSchemasStreamsHeaderDefinitionType string

const (
	SourceSharepointEnterpriseUpdateSchemasStreamsHeaderDefinitionTypeUserProvided SourceSharepointEnterpriseUpdateSchemasStreamsHeaderDefinitionType = "User Provided"
)

func (e SourceSharepointEnterpriseUpdateSchemasStreamsHeaderDefinitionType) ToPointer() *SourceSharepointEnterpriseUpdateSchemasStreamsHeaderDefinitionType {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateSchemasStreamsHeaderDefinitionType) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "User Provided":
		*e = SourceSharepointEnterpriseUpdateSchemasStreamsHeaderDefinitionType(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateSchemasStreamsHeaderDefinitionType: %v", v)
	}
}

type SourceSharepointEnterpriseUpdateUserProvided struct {
	// The column names that will be used while emitting the CSV records
	ColumnNames          []string                                                            `json:"column_names"`
	headerDefinitionType *SourceSharepointEnterpriseUpdateSchemasStreamsHeaderDefinitionType `const:"User Provided" json:"header_definition_type"`
}

func (s SourceSharepointEnterpriseUpdateUserProvided) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceSharepointEnterpriseUpdateUserProvided) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *SourceSharepointEnterpriseUpdateUserProvided) GetColumnNames() []string {
	if o == nil {
		return []string{}
	}
	return o.ColumnNames
}

func (o *SourceSharepointEnterpriseUpdateUserProvided) GetHeaderDefinitionType() *SourceSharepointEnterpriseUpdateSchemasStreamsHeaderDefinitionType {
	return SourceSharepointEnterpriseUpdateSchemasStreamsHeaderDefinitionTypeUserProvided.ToPointer()
}

type SourceSharepointEnterpriseUpdateSchemasHeaderDefinitionType string

const (
	SourceSharepointEnterpriseUpdateSchemasHeaderDefinitionTypeAutogenerated SourceSharepointEnterpriseUpdateSchemasHeaderDefinitionType = "Autogenerated"
)

func (e SourceSharepointEnterpriseUpdateSchemasHeaderDefinitionType) ToPointer() *SourceSharepointEnterpriseUpdateSchemasHeaderDefinitionType {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateSchemasHeaderDefinitionType) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "Autogenerated":
		*e = SourceSharepointEnterpriseUpdateSchemasHeaderDefinitionType(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateSchemasHeaderDefinitionType: %v", v)
	}
}

type SourceSharepointEnterpriseUpdateAutogenerated struct {
	headerDefinitionType *SourceSharepointEnterpriseUpdateSchemasHeaderDefinitionType `const:"Autogenerated" json:"header_definition_type"`
}

func (s SourceSharepointEnterpriseUpdateAutogenerated) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceSharepointEnterpriseUpdateAutogenerated) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *SourceSharepointEnterpriseUpdateAutogenerated) GetHeaderDefinitionType() *SourceSharepointEnterpriseUpdateSchemasHeaderDefinitionType {
	return SourceSharepointEnterpriseUpdateSchemasHeaderDefinitionTypeAutogenerated.ToPointer()
}

type SourceSharepointEnterpriseUpdateHeaderDefinitionType string

const (
	SourceSharepointEnterpriseUpdateHeaderDefinitionTypeFromCsv SourceSharepointEnterpriseUpdateHeaderDefinitionType = "From CSV"
)

func (e SourceSharepointEnterpriseUpdateHeaderDefinitionType) ToPointer() *SourceSharepointEnterpriseUpdateHeaderDefinitionType {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateHeaderDefinitionType) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "From CSV":
		*e = SourceSharepointEnterpriseUpdateHeaderDefinitionType(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateHeaderDefinitionType: %v", v)
	}
}

type SourceSharepointEnterpriseUpdateFromCSV struct {
	headerDefinitionType *SourceSharepointEnterpriseUpdateHeaderDefinitionType `const:"From CSV" json:"header_definition_type"`
}

func (s SourceSharepointEnterpriseUpdateFromCSV) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceSharepointEnterpriseUpdateFromCSV) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *SourceSharepointEnterpriseUpdateFromCSV) GetHeaderDefinitionType() *SourceSharepointEnterpriseUpdateHeaderDefinitionType {
	return SourceSharepointEnterpriseUpdateHeaderDefinitionTypeFromCsv.ToPointer()
}

type SourceSharepointEnterpriseUpdateCSVHeaderDefinitionType string

const (
	SourceSharepointEnterpriseUpdateCSVHeaderDefinitionTypeSourceSharepointEnterpriseUpdateFromCSV       SourceSharepointEnterpriseUpdateCSVHeaderDefinitionType = "source-sharepoint-enterprise-update_From CSV"
	SourceSharepointEnterpriseUpdateCSVHeaderDefinitionTypeSourceSharepointEnterpriseUpdateAutogenerated SourceSharepointEnterpriseUpdateCSVHeaderDefinitionType = "source-sharepoint-enterprise-update_Autogenerated"
	SourceSharepointEnterpriseUpdateCSVHeaderDefinitionTypeSourceSharepointEnterpriseUpdateUserProvided  SourceSharepointEnterpriseUpdateCSVHeaderDefinitionType = "source-sharepoint-enterprise-update_User Provided"
)

// SourceSharepointEnterpriseUpdateCSVHeaderDefinition - How headers will be defined. `User Provided` assumes the CSV does not have a header row and uses the headers provided and `Autogenerated` assumes the CSV does not have a header row and the CDK will generate headers using for `f{i}` where `i` is the index starting from 0. Else, the default behavior is to use the header from the CSV file. If a user wants to autogenerate or provide column names for a CSV having headers, they can skip rows.
type SourceSharepointEnterpriseUpdateCSVHeaderDefinition struct {
	SourceSharepointEnterpriseUpdateFromCSV       *SourceSharepointEnterpriseUpdateFromCSV       `queryParam:"inline"`
	SourceSharepointEnterpriseUpdateAutogenerated *SourceSharepointEnterpriseUpdateAutogenerated `queryParam:"inline"`
	SourceSharepointEnterpriseUpdateUserProvided  *SourceSharepointEnterpriseUpdateUserProvided  `queryParam:"inline"`

	Type SourceSharepointEnterpriseUpdateCSVHeaderDefinitionType
}

func CreateSourceSharepointEnterpriseUpdateCSVHeaderDefinitionSourceSharepointEnterpriseUpdateFromCSV(sourceSharepointEnterpriseUpdateFromCSV SourceSharepointEnterpriseUpdateFromCSV) SourceSharepointEnterpriseUpdateCSVHeaderDefinition {
	typ := SourceSharepointEnterpriseUpdateCSVHeaderDefinitionTypeSourceSharepointEnterpriseUpdateFromCSV

	return SourceSharepointEnterpriseUpdateCSVHeaderDefinition{
		SourceSharepointEnterpriseUpdateFromCSV: &sourceSharepointEnterpriseUpdateFromCSV,
		Type:                                    typ,
	}
}

func CreateSourceSharepointEnterpriseUpdateCSVHeaderDefinitionSourceSharepointEnterpriseUpdateAutogenerated(sourceSharepointEnterpriseUpdateAutogenerated SourceSharepointEnterpriseUpdateAutogenerated) SourceSharepointEnterpriseUpdateCSVHeaderDefinition {
	typ := SourceSharepointEnterpriseUpdateCSVHeaderDefinitionTypeSourceSharepointEnterpriseUpdateAutogenerated

	return SourceSharepointEnterpriseUpdateCSVHeaderDefinition{
		SourceSharepointEnterpriseUpdateAutogenerated: &sourceSharepointEnterpriseUpdateAutogenerated,
		Type: typ,
	}
}

func CreateSourceSharepointEnterpriseUpdateCSVHeaderDefinitionSourceSharepointEnterpriseUpdateUserProvided(sourceSharepointEnterpriseUpdateUserProvided SourceSharepointEnterpriseUpdateUserProvided) SourceSharepointEnterpriseUpdateCSVHeaderDefinition {
	typ := SourceSharepointEnterpriseUpdateCSVHeaderDefinitionTypeSourceSharepointEnterpriseUpdateUserProvided

	return SourceSharepointEnterpriseUpdateCSVHeaderDefinition{
		SourceSharepointEnterpriseUpdateUserProvided: &sourceSharepointEnterpriseUpdateUserProvided,
		Type: typ,
	}
}

func (u *SourceSharepointEnterpriseUpdateCSVHeaderDefinition) UnmarshalJSON(data []byte) error {

	var sourceSharepointEnterpriseUpdateFromCSV SourceSharepointEnterpriseUpdateFromCSV = SourceSharepointEnterpriseUpdateFromCSV{}
	if err := utils.UnmarshalJSON(data, &sourceSharepointEnterpriseUpdateFromCSV, "", true, true); err == nil {
		u.SourceSharepointEnterpriseUpdateFromCSV = &sourceSharepointEnterpriseUpdateFromCSV
		u.Type = SourceSharepointEnterpriseUpdateCSVHeaderDefinitionTypeSourceSharepointEnterpriseUpdateFromCSV
		return nil
	}

	var sourceSharepointEnterpriseUpdateAutogenerated SourceSharepointEnterpriseUpdateAutogenerated = SourceSharepointEnterpriseUpdateAutogenerated{}
	if err := utils.UnmarshalJSON(data, &sourceSharepointEnterpriseUpdateAutogenerated, "", true, true); err == nil {
		u.SourceSharepointEnterpriseUpdateAutogenerated = &sourceSharepointEnterpriseUpdateAutogenerated
		u.Type = SourceSharepointEnterpriseUpdateCSVHeaderDefinitionTypeSourceSharepointEnterpriseUpdateAutogenerated
		return nil
	}

	var sourceSharepointEnterpriseUpdateUserProvided SourceSharepointEnterpriseUpdateUserProvided = SourceSharepointEnterpriseUpdateUserProvided{}
	if err := utils.UnmarshalJSON(data, &sourceSharepointEnterpriseUpdateUserProvided, "", true, true); err == nil {
		u.SourceSharepointEnterpriseUpdateUserProvided = &sourceSharepointEnterpriseUpdateUserProvided
		u.Type = SourceSharepointEnterpriseUpdateCSVHeaderDefinitionTypeSourceSharepointEnterpriseUpdateUserProvided
		return nil
	}

	return fmt.Errorf("could not unmarshal `%s` into any supported union types for SourceSharepointEnterpriseUpdateCSVHeaderDefinition", string(data))
}

func (u SourceSharepointEnterpriseUpdateCSVHeaderDefinition) MarshalJSON() ([]byte, error) {
	if u.SourceSharepointEnterpriseUpdateFromCSV != nil {
		return utils.MarshalJSON(u.SourceSharepointEnterpriseUpdateFromCSV, "", true)
	}

	if u.SourceSharepointEnterpriseUpdateAutogenerated != nil {
		return utils.MarshalJSON(u.SourceSharepointEnterpriseUpdateAutogenerated, "", true)
	}

	if u.SourceSharepointEnterpriseUpdateUserProvided != nil {
		return utils.MarshalJSON(u.SourceSharepointEnterpriseUpdateUserProvided, "", true)
	}

	return nil, errors.New("could not marshal union type SourceSharepointEnterpriseUpdateCSVHeaderDefinition: all fields are null")
}

type SourceSharepointEnterpriseUpdateCSVFormat struct {
	// The character delimiting individual cells in the CSV data. This may only be a 1-character string. For tab-delimited data enter '\t'.
	Delimiter *string `default:"," json:"delimiter"`
	// Whether two quotes in a quoted CSV value denote a single quote in the data.
	DoubleQuote *bool `default:"true" json:"double_quote"`
	// The character encoding of the CSV data. Leave blank to default to <strong>UTF8</strong>. See <a href="https://docs.python.org/3/library/codecs.html#standard-encodings" target="_blank">list of python encodings</a> for allowable options.
	Encoding *string `default:"utf8" json:"encoding"`
	// The character used for escaping special characters. To disallow escaping, leave this field blank.
	EscapeChar *string `json:"escape_char,omitempty"`
	// A set of case-sensitive strings that should be interpreted as false values.
	FalseValues []string                                         `json:"false_values,omitempty"`
	filetype    *SourceSharepointEnterpriseUpdateSchemasFiletype `const:"csv" json:"filetype"`
	// How headers will be defined. `User Provided` assumes the CSV does not have a header row and uses the headers provided and `Autogenerated` assumes the CSV does not have a header row and the CDK will generate headers using for `f{i}` where `i` is the index starting from 0. Else, the default behavior is to use the header from the CSV file. If a user wants to autogenerate or provide column names for a CSV having headers, they can skip rows.
	HeaderDefinition *SourceSharepointEnterpriseUpdateCSVHeaderDefinition `json:"header_definition,omitempty"`
	// Whether to ignore errors that occur when the number of fields in the CSV does not match the number of columns in the schema.
	IgnoreErrorsOnFieldsMismatch *bool `default:"false" json:"ignore_errors_on_fields_mismatch"`
	// A set of case-sensitive strings that should be interpreted as null values. For example, if the value 'NA' should be interpreted as null, enter 'NA' in this field.
	NullValues []string `json:"null_values,omitempty"`
	// The character used for quoting CSV values. To disallow quoting, make this field blank.
	QuoteChar *string `default:"\"" json:"quote_char"`
	// The number of rows to skip after the header row.
	SkipRowsAfterHeader *int64 `default:"0" json:"skip_rows_after_header"`
	// The number of rows to skip before the header row. For example, if the header row is on the 3rd row, enter 2 in this field.
	SkipRowsBeforeHeader *int64 `default:"0" json:"skip_rows_before_header"`
	// Whether strings can be interpreted as null values. If true, strings that match the null_values set will be interpreted as null. If false, strings that match the null_values set will be interpreted as the string itself.
	StringsCanBeNull *bool `default:"true" json:"strings_can_be_null"`
	// A set of case-sensitive strings that should be interpreted as true values.
	TrueValues []string `json:"true_values,omitempty"`
}

func (s SourceSharepointEnterpriseUpdateCSVFormat) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceSharepointEnterpriseUpdateCSVFormat) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *SourceSharepointEnterpriseUpdateCSVFormat) GetDelimiter() *string {
	if o == nil {
		return nil
	}
	return o.Delimiter
}

func (o *SourceSharepointEnterpriseUpdateCSVFormat) GetDoubleQuote() *bool {
	if o == nil {
		return nil
	}
	return o.DoubleQuote
}

func (o *SourceSharepointEnterpriseUpdateCSVFormat) GetEncoding() *string {
	if o == nil {
		return nil
	}
	return o.Encoding
}

func (o *SourceSharepointEnterpriseUpdateCSVFormat) GetEscapeChar() *string {
	if o == nil {
		return nil
	}
	return o.EscapeChar
}

func (o *SourceSharepointEnterpriseUpdateCSVFormat) GetFalseValues() []string {
	if o == nil {
		return nil
	}
	return o.FalseValues
}

func (o *SourceSharepointEnterpriseUpdateCSVFormat) GetFiletype() *SourceSharepointEnterpriseUpdateSchemasFiletype {
	return SourceSharepointEnterpriseUpdateSchemasFiletypeCsv.ToPointer()
}

func (o *SourceSharepointEnterpriseUpdateCSVFormat) GetHeaderDefinition() *SourceSharepointEnterpriseUpdateCSVHeaderDefinition {
	if o == nil {
		return nil
	}
	return o.HeaderDefinition
}

func (o *SourceSharepointEnterpriseUpdateCSVFormat) GetIgnoreErrorsOnFieldsMismatch() *bool {
	if o == nil {
		return nil
	}
	return o.IgnoreErrorsOnFieldsMismatch
}

func (o *SourceSharepointEnterpriseUpdateCSVFormat) GetNullValues() []string {
	if o == nil {
		return nil
	}
	return o.NullValues
}

func (o *SourceSharepointEnterpriseUpdateCSVFormat) GetQuoteChar() *string {
	if o == nil {
		return nil
	}
	return o.QuoteChar
}

func (o *SourceSharepointEnterpriseUpdateCSVFormat) GetSkipRowsAfterHeader() *int64 {
	if o == nil {
		return nil
	}
	return o.SkipRowsAfterHeader
}

func (o *SourceSharepointEnterpriseUpdateCSVFormat) GetSkipRowsBeforeHeader() *int64 {
	if o == nil {
		return nil
	}
	return o.SkipRowsBeforeHeader
}

func (o *SourceSharepointEnterpriseUpdateCSVFormat) GetStringsCanBeNull() *bool {
	if o == nil {
		return nil
	}
	return o.StringsCanBeNull
}

func (o *SourceSharepointEnterpriseUpdateCSVFormat) GetTrueValues() []string {
	if o == nil {
		return nil
	}
	return o.TrueValues
}

type SourceSharepointEnterpriseUpdateFiletype string

const (
	SourceSharepointEnterpriseUpdateFiletypeAvro SourceSharepointEnterpriseUpdateFiletype = "avro"
)

func (e SourceSharepointEnterpriseUpdateFiletype) ToPointer() *SourceSharepointEnterpriseUpdateFiletype {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateFiletype) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "avro":
		*e = SourceSharepointEnterpriseUpdateFiletype(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateFiletype: %v", v)
	}
}

type SourceSharepointEnterpriseUpdateAvroFormat struct {
	// Whether to convert double fields to strings. This is recommended if you have decimal numbers with a high degree of precision because there can be a loss precision when handling floating point numbers.
	DoubleAsString *bool                                     `default:"false" json:"double_as_string"`
	filetype       *SourceSharepointEnterpriseUpdateFiletype `const:"avro" json:"filetype"`
}

func (s SourceSharepointEnterpriseUpdateAvroFormat) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceSharepointEnterpriseUpdateAvroFormat) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *SourceSharepointEnterpriseUpdateAvroFormat) GetDoubleAsString() *bool {
	if o == nil {
		return nil
	}
	return o.DoubleAsString
}

func (o *SourceSharepointEnterpriseUpdateAvroFormat) GetFiletype() *SourceSharepointEnterpriseUpdateFiletype {
	return SourceSharepointEnterpriseUpdateFiletypeAvro.ToPointer()
}

type SourceSharepointEnterpriseUpdateFormatType string

const (
	SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateAvroFormat                 SourceSharepointEnterpriseUpdateFormatType = "source-sharepoint-enterprise-update_Avro Format"
	SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateCSVFormat                  SourceSharepointEnterpriseUpdateFormatType = "source-sharepoint-enterprise-update_CSV Format"
	SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateJsonlFormat                SourceSharepointEnterpriseUpdateFormatType = "source-sharepoint-enterprise-update_Jsonl Format"
	SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateParquetFormat              SourceSharepointEnterpriseUpdateFormatType = "source-sharepoint-enterprise-update_Parquet Format"
	SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateUnstructuredDocumentFormat SourceSharepointEnterpriseUpdateFormatType = "source-sharepoint-enterprise-update_Unstructured Document Format"
	SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateExcelFormat                SourceSharepointEnterpriseUpdateFormatType = "source-sharepoint-enterprise-update_Excel Format"
)

// SourceSharepointEnterpriseUpdateFormat - The configuration options that are used to alter how to read incoming files that deviate from the standard formatting.
type SourceSharepointEnterpriseUpdateFormat struct {
	SourceSharepointEnterpriseUpdateAvroFormat                 *SourceSharepointEnterpriseUpdateAvroFormat                 `queryParam:"inline"`
	SourceSharepointEnterpriseUpdateCSVFormat                  *SourceSharepointEnterpriseUpdateCSVFormat                  `queryParam:"inline"`
	SourceSharepointEnterpriseUpdateJsonlFormat                *SourceSharepointEnterpriseUpdateJsonlFormat                `queryParam:"inline"`
	SourceSharepointEnterpriseUpdateParquetFormat              *SourceSharepointEnterpriseUpdateParquetFormat              `queryParam:"inline"`
	SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat *SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat `queryParam:"inline"`
	SourceSharepointEnterpriseUpdateExcelFormat                *SourceSharepointEnterpriseUpdateExcelFormat                `queryParam:"inline"`

	Type SourceSharepointEnterpriseUpdateFormatType
}

func CreateSourceSharepointEnterpriseUpdateFormatSourceSharepointEnterpriseUpdateAvroFormat(sourceSharepointEnterpriseUpdateAvroFormat SourceSharepointEnterpriseUpdateAvroFormat) SourceSharepointEnterpriseUpdateFormat {
	typ := SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateAvroFormat

	return SourceSharepointEnterpriseUpdateFormat{
		SourceSharepointEnterpriseUpdateAvroFormat: &sourceSharepointEnterpriseUpdateAvroFormat,
		Type: typ,
	}
}

func CreateSourceSharepointEnterpriseUpdateFormatSourceSharepointEnterpriseUpdateCSVFormat(sourceSharepointEnterpriseUpdateCSVFormat SourceSharepointEnterpriseUpdateCSVFormat) SourceSharepointEnterpriseUpdateFormat {
	typ := SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateCSVFormat

	return SourceSharepointEnterpriseUpdateFormat{
		SourceSharepointEnterpriseUpdateCSVFormat: &sourceSharepointEnterpriseUpdateCSVFormat,
		Type: typ,
	}
}

func CreateSourceSharepointEnterpriseUpdateFormatSourceSharepointEnterpriseUpdateJsonlFormat(sourceSharepointEnterpriseUpdateJsonlFormat SourceSharepointEnterpriseUpdateJsonlFormat) SourceSharepointEnterpriseUpdateFormat {
	typ := SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateJsonlFormat

	return SourceSharepointEnterpriseUpdateFormat{
		SourceSharepointEnterpriseUpdateJsonlFormat: &sourceSharepointEnterpriseUpdateJsonlFormat,
		Type: typ,
	}
}

func CreateSourceSharepointEnterpriseUpdateFormatSourceSharepointEnterpriseUpdateParquetFormat(sourceSharepointEnterpriseUpdateParquetFormat SourceSharepointEnterpriseUpdateParquetFormat) SourceSharepointEnterpriseUpdateFormat {
	typ := SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateParquetFormat

	return SourceSharepointEnterpriseUpdateFormat{
		SourceSharepointEnterpriseUpdateParquetFormat: &sourceSharepointEnterpriseUpdateParquetFormat,
		Type: typ,
	}
}

func CreateSourceSharepointEnterpriseUpdateFormatSourceSharepointEnterpriseUpdateUnstructuredDocumentFormat(sourceSharepointEnterpriseUpdateUnstructuredDocumentFormat SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat) SourceSharepointEnterpriseUpdateFormat {
	typ := SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateUnstructuredDocumentFormat

	return SourceSharepointEnterpriseUpdateFormat{
		SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat: &sourceSharepointEnterpriseUpdateUnstructuredDocumentFormat,
		Type: typ,
	}
}

func CreateSourceSharepointEnterpriseUpdateFormatSourceSharepointEnterpriseUpdateExcelFormat(sourceSharepointEnterpriseUpdateExcelFormat SourceSharepointEnterpriseUpdateExcelFormat) SourceSharepointEnterpriseUpdateFormat {
	typ := SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateExcelFormat

	return SourceSharepointEnterpriseUpdateFormat{
		SourceSharepointEnterpriseUpdateExcelFormat: &sourceSharepointEnterpriseUpdateExcelFormat,
		Type: typ,
	}
}

func (u *SourceSharepointEnterpriseUpdateFormat) UnmarshalJSON(data []byte) error {

	var sourceSharepointEnterpriseUpdateJsonlFormat SourceSharepointEnterpriseUpdateJsonlFormat = SourceSharepointEnterpriseUpdateJsonlFormat{}
	if err := utils.UnmarshalJSON(data, &sourceSharepointEnterpriseUpdateJsonlFormat, "", true, true); err == nil {
		u.SourceSharepointEnterpriseUpdateJsonlFormat = &sourceSharepointEnterpriseUpdateJsonlFormat
		u.Type = SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateJsonlFormat
		return nil
	}

	var sourceSharepointEnterpriseUpdateExcelFormat SourceSharepointEnterpriseUpdateExcelFormat = SourceSharepointEnterpriseUpdateExcelFormat{}
	if err := utils.UnmarshalJSON(data, &sourceSharepointEnterpriseUpdateExcelFormat, "", true, true); err == nil {
		u.SourceSharepointEnterpriseUpdateExcelFormat = &sourceSharepointEnterpriseUpdateExcelFormat
		u.Type = SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateExcelFormat
		return nil
	}

	var sourceSharepointEnterpriseUpdateAvroFormat SourceSharepointEnterpriseUpdateAvroFormat = SourceSharepointEnterpriseUpdateAvroFormat{}
	if err := utils.UnmarshalJSON(data, &sourceSharepointEnterpriseUpdateAvroFormat, "", true, true); err == nil {
		u.SourceSharepointEnterpriseUpdateAvroFormat = &sourceSharepointEnterpriseUpdateAvroFormat
		u.Type = SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateAvroFormat
		return nil
	}

	var sourceSharepointEnterpriseUpdateParquetFormat SourceSharepointEnterpriseUpdateParquetFormat = SourceSharepointEnterpriseUpdateParquetFormat{}
	if err := utils.UnmarshalJSON(data, &sourceSharepointEnterpriseUpdateParquetFormat, "", true, true); err == nil {
		u.SourceSharepointEnterpriseUpdateParquetFormat = &sourceSharepointEnterpriseUpdateParquetFormat
		u.Type = SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateParquetFormat
		return nil
	}

	var sourceSharepointEnterpriseUpdateUnstructuredDocumentFormat SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat = SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat{}
	if err := utils.UnmarshalJSON(data, &sourceSharepointEnterpriseUpdateUnstructuredDocumentFormat, "", true, true); err == nil {
		u.SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat = &sourceSharepointEnterpriseUpdateUnstructuredDocumentFormat
		u.Type = SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateUnstructuredDocumentFormat
		return nil
	}

	var sourceSharepointEnterpriseUpdateCSVFormat SourceSharepointEnterpriseUpdateCSVFormat = SourceSharepointEnterpriseUpdateCSVFormat{}
	if err := utils.UnmarshalJSON(data, &sourceSharepointEnterpriseUpdateCSVFormat, "", true, true); err == nil {
		u.SourceSharepointEnterpriseUpdateCSVFormat = &sourceSharepointEnterpriseUpdateCSVFormat
		u.Type = SourceSharepointEnterpriseUpdateFormatTypeSourceSharepointEnterpriseUpdateCSVFormat
		return nil
	}

	return fmt.Errorf("could not unmarshal `%s` into any supported union types for SourceSharepointEnterpriseUpdateFormat", string(data))
}

func (u SourceSharepointEnterpriseUpdateFormat) MarshalJSON() ([]byte, error) {
	if u.SourceSharepointEnterpriseUpdateAvroFormat != nil {
		return utils.MarshalJSON(u.SourceSharepointEnterpriseUpdateAvroFormat, "", true)
	}

	if u.SourceSharepointEnterpriseUpdateCSVFormat != nil {
		return utils.MarshalJSON(u.SourceSharepointEnterpriseUpdateCSVFormat, "", true)
	}

	if u.SourceSharepointEnterpriseUpdateJsonlFormat != nil {
		return utils.MarshalJSON(u.SourceSharepointEnterpriseUpdateJsonlFormat, "", true)
	}

	if u.SourceSharepointEnterpriseUpdateParquetFormat != nil {
		return utils.MarshalJSON(u.SourceSharepointEnterpriseUpdateParquetFormat, "", true)
	}

	if u.SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat != nil {
		return utils.MarshalJSON(u.SourceSharepointEnterpriseUpdateUnstructuredDocumentFormat, "", true)
	}

	if u.SourceSharepointEnterpriseUpdateExcelFormat != nil {
		return utils.MarshalJSON(u.SourceSharepointEnterpriseUpdateExcelFormat, "", true)
	}

	return nil, errors.New("could not marshal union type SourceSharepointEnterpriseUpdateFormat: all fields are null")
}

// SourceSharepointEnterpriseUpdateValidationPolicy - The name of the validation policy that dictates sync behavior when a record does not adhere to the stream schema.
type SourceSharepointEnterpriseUpdateValidationPolicy string

const (
	SourceSharepointEnterpriseUpdateValidationPolicyEmitRecord      SourceSharepointEnterpriseUpdateValidationPolicy = "Emit Record"
	SourceSharepointEnterpriseUpdateValidationPolicySkipRecord      SourceSharepointEnterpriseUpdateValidationPolicy = "Skip Record"
	SourceSharepointEnterpriseUpdateValidationPolicyWaitForDiscover SourceSharepointEnterpriseUpdateValidationPolicy = "Wait for Discover"
)

func (e SourceSharepointEnterpriseUpdateValidationPolicy) ToPointer() *SourceSharepointEnterpriseUpdateValidationPolicy {
	return &e
}
func (e *SourceSharepointEnterpriseUpdateValidationPolicy) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "Emit Record":
		fallthrough
	case "Skip Record":
		fallthrough
	case "Wait for Discover":
		*e = SourceSharepointEnterpriseUpdateValidationPolicy(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceSharepointEnterpriseUpdateValidationPolicy: %v", v)
	}
}

type SourceSharepointEnterpriseUpdateFileBasedStreamConfig struct {
	// When the state history of the file store is full, syncs will only read files that were last modified in the provided day range.
	DaysToSyncIfHistoryIsFull *int64 `default:"3" json:"days_to_sync_if_history_is_full"`
	// The configuration options that are used to alter how to read incoming files that deviate from the standard formatting.
	Format SourceSharepointEnterpriseUpdateFormat `json:"format"`
	// The pattern used to specify which files should be selected from the file system. For more information on glob pattern matching look <a href="https://en.wikipedia.org/wiki/Glob_(programming)">here</a>.
	Globs []string `json:"globs,omitempty"`
	// The schema that will be used to validate records extracted from the file. This will override the stream schema that is auto-detected from incoming files.
	InputSchema *string `json:"input_schema,omitempty"`
	// The name of the stream.
	Name string `json:"name"`
	// The number of resent files which will be used to discover the schema for this stream.
	RecentNFilesToReadForSchemaDiscovery *int64 `json:"recent_n_files_to_read_for_schema_discovery,omitempty"`
	// When enabled, syncs will not validate or structure records against the stream's schema.
	Schemaless *bool `default:"false" json:"schemaless"`
	// The name of the validation policy that dictates sync behavior when a record does not adhere to the stream schema.
	ValidationPolicy *SourceSharepointEnterpriseUpdateValidationPolicy `default:"Emit Record" json:"validation_policy"`
}

func (s SourceSharepointEnterpriseUpdateFileBasedStreamConfig) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceSharepointEnterpriseUpdateFileBasedStreamConfig) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil {
		return err
	}
	return nil
}

func (o *SourceSharepointEnterpriseUpdateFileBasedStreamConfig) GetDaysToSyncIfHistoryIsFull() *int64 {
	if o == nil {
		return nil
	}
	return o.DaysToSyncIfHistoryIsFull
}

func (o *SourceSharepointEnterpriseUpdateFileBasedStreamConfig) GetFormat() SourceSharepointEnterpriseUpdateFormat {
	if o == nil {
		return SourceSharepointEnterpriseUpdateFormat{}
	}
	return o.Format
}

func (o *SourceSharepointEnterpriseUpdateFileBasedStreamConfig) GetGlobs() []string {
	if o == nil {
		return nil
	}
	return o.Globs
}

func (o *SourceSharepointEnterpriseUpdateFileBasedStreamConfig) GetInputSchema() *string {
	if o == nil {
		return nil
	}
	return o.InputSchema
}

func (o *SourceSharepointEnterpriseUpdateFileBasedStreamConfig) GetName() string {
	if o == nil {
		return ""
	}
	return o.Name
}

func (o *SourceSharepointEnterpriseUpdateFileBasedStreamConfig) GetRecentNFilesToReadForSchemaDiscovery() *int64 {
	if o == nil {
		return nil
	}
	return o.RecentNFilesToReadForSchemaDiscovery
}

func (o *SourceSharepointEnterpriseUpdateFileBasedStreamConfig) GetSchemaless() *bool {
	if o == nil {
		return nil
	}
	return o.Schemaless
}

func (o *SourceSharepointEnterpriseUpdateFileBasedStreamConfig) GetValidationPolicy() *SourceSharepointEnterpriseUpdateValidationPolicy {
	if o == nil {
		return nil
	}
	return o.ValidationPolicy
}

// SourceSharepointEnterpriseUpdate - SourceMicrosoftSharePointSpec class for Microsoft SharePoint Source Specification.
// This class combines the authentication details with additional configuration for the SharePoint API.
type SourceSharepointEnterpriseUpdate struct {
	// Credentials for connecting to the One Drive API
	Credentials    SourceSharepointEnterpriseUpdateAuthentication  `json:"credentials"`
	DeliveryMethod *SourceSharepointEnterpriseUpdateDeliveryMethod `json:"delivery_method,omitempty"`
	// Path to a specific folder within the drives to search for files. Leave empty to search all folders of the drives. This does not apply to shared items.
	FolderPath *string `default:"." json:"folder_path"`
	// Specifies the location(s) to search for files. Valid options are 'ACCESSIBLE_DRIVES' for all SharePoint drives the user can access, 'SHARED_ITEMS' for shared items the user has access to, and 'ALL' to search both.
	SearchScope *SourceSharepointEnterpriseUpdateSearchScope `default:"ALL" json:"search_scope"`
	// Url of SharePoint site to search for files. Leave empty to search in the main site. Use 'https://<tenant_name>.sharepoint.com/sites/' to iterate over all sites.
	SiteURL *string `default:"" json:"site_url"`
	// UTC date and time in the format 2017-01-25T00:00:00.000000Z. Any file modified before this date will not be replicated.
	StartDate *time.Time `json:"start_date,omitempty"`
	// Each instance of this configuration defines a <a href="https://docs.airbyte.com/cloud/core-concepts#stream">stream</a>. Use this to define which files belong in the stream, their format, and how they should be parsed and validated. When sending data to warehouse destination such as Snowflake or BigQuery, each stream is a separate table.
	Streams []SourceSharepointEnterpriseUpdateFileBasedStreamConfig `json:"streams"`
}

func (s SourceSharepointEnterpriseUpdate) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceSharepointEnterpriseUpdate) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil {
		return err
	}
	return nil
}

func (o *SourceSharepointEnterpriseUpdate) GetCredentials() SourceSharepointEnterpriseUpdateAuthentication {
	if o == nil {
		return SourceSharepointEnterpriseUpdateAuthentication{}
	}
	return o.Credentials
}

func (o *SourceSharepointEnterpriseUpdate) GetDeliveryMethod() *SourceSharepointEnterpriseUpdateDeliveryMethod {
	if o == nil {
		return nil
	}
	return o.DeliveryMethod
}

func (o *SourceSharepointEnterpriseUpdate) GetFolderPath() *string {
	if o == nil {
		return nil
	}
	return o.FolderPath
}

func (o *SourceSharepointEnterpriseUpdate) GetSearchScope() *SourceSharepointEnterpriseUpdateSearchScope {
	if o == nil {
		return nil
	}
	return o.SearchScope
}

func (o *SourceSharepointEnterpriseUpdate) GetSiteURL() *string {
	if o == nil {
		return nil
	}
	return o.SiteURL
}

func (o *SourceSharepointEnterpriseUpdate) GetStartDate() *time.Time {
	if o == nil {
		return nil
	}
	return o.StartDate
}

func (o *SourceSharepointEnterpriseUpdate) GetStreams() []SourceSharepointEnterpriseUpdateFileBasedStreamConfig {
	if o == nil {
		return []SourceSharepointEnterpriseUpdateFileBasedStreamConfig{}
	}
	return o.Streams
}
