// Code generated by azure-service-operator-codegen. DO NOT EDIT.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package arm

import (
	"encoding/json"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime"
	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
)

type Factory_Spec struct {
	AdditionalProperties map[string]v1.JSON `json:"additionalProperties,omitempty"`

	// Identity: Managed service identity of the factory.
	Identity *FactoryIdentity `json:"identity,omitempty"`

	// Location: The resource location.
	Location *string `json:"location,omitempty"`
	Name     string  `json:"name,omitempty"`

	// Properties: Properties of the factory.
	Properties *FactoryProperties `json:"properties,omitempty"`

	// Tags: The resource tags.
	Tags map[string]string `json:"tags,omitempty"`
}

var _ genruntime.ARMResourceSpec = &Factory_Spec{}

// GetAPIVersion returns the ARM API version of the resource. This is always "2018-06-01"
func (factory Factory_Spec) GetAPIVersion() string {
	return "2018-06-01"
}

// GetName returns the Name of the resource
func (factory *Factory_Spec) GetName() string {
	return factory.Name
}

// GetType returns the ARM Type of the resource. This is always "Microsoft.DataFactory/factories"
func (factory *Factory_Spec) GetType() string {
	return "Microsoft.DataFactory/factories"
}

// Identity properties of the factory resource.
type FactoryIdentity struct {
	// Type: The identity type.
	Type                   *FactoryIdentity_Type                  `json:"type,omitempty"`
	UserAssignedIdentities map[string]UserAssignedIdentityDetails `json:"userAssignedIdentities,omitempty"`
}

// Factory resource properties.
type FactoryProperties struct {
	// Encryption: Properties to enable Customer Managed Key for the factory.
	Encryption *EncryptionConfiguration `json:"encryption,omitempty"`

	// GlobalParameters: List of parameters for factory.
	GlobalParameters map[string]GlobalParameterSpecification `json:"globalParameters,omitempty"`

	// PublicNetworkAccess: Whether or not public network access is allowed for the data factory.
	PublicNetworkAccess *FactoryProperties_PublicNetworkAccess `json:"publicNetworkAccess,omitempty"`

	// PurviewConfiguration: Purview information of the factory.
	PurviewConfiguration *PurviewConfiguration `json:"purviewConfiguration,omitempty"`

	// RepoConfiguration: Git repo information of the factory.
	RepoConfiguration *FactoryRepoConfiguration `json:"repoConfiguration,omitempty"`
}

// Definition of CMK for the factory.
type EncryptionConfiguration struct {
	// Identity: User assigned identity to use to authenticate to customer's key vault. If not provided Managed Service
	// Identity will be used.
	Identity *CMKIdentityDefinition `json:"identity,omitempty"`

	// KeyName: The name of the key in Azure Key Vault to use as Customer Managed Key.
	KeyName *string `json:"keyName,omitempty"`

	// KeyVersion: The version of the key used for CMK. If not provided, latest version will be used.
	KeyVersion *string `json:"keyVersion,omitempty"`

	// VaultBaseUrl: The url of the Azure Key Vault used for CMK.
	VaultBaseUrl *string `json:"vaultBaseUrl,omitempty"`
}

// +kubebuilder:validation:Enum={"SystemAssigned","SystemAssigned,UserAssigned","UserAssigned"}
type FactoryIdentity_Type string

const (
	FactoryIdentity_Type_SystemAssigned             = FactoryIdentity_Type("SystemAssigned")
	FactoryIdentity_Type_SystemAssignedUserAssigned = FactoryIdentity_Type("SystemAssigned,UserAssigned")
	FactoryIdentity_Type_UserAssigned               = FactoryIdentity_Type("UserAssigned")
)

// Mapping from string to FactoryIdentity_Type
var factoryIdentity_Type_Values = map[string]FactoryIdentity_Type{
	"systemassigned":              FactoryIdentity_Type_SystemAssigned,
	"systemassigned,userassigned": FactoryIdentity_Type_SystemAssignedUserAssigned,
	"userassigned":                FactoryIdentity_Type_UserAssigned,
}

// +kubebuilder:validation:Enum={"Disabled","Enabled"}
type FactoryProperties_PublicNetworkAccess string

const (
	FactoryProperties_PublicNetworkAccess_Disabled = FactoryProperties_PublicNetworkAccess("Disabled")
	FactoryProperties_PublicNetworkAccess_Enabled  = FactoryProperties_PublicNetworkAccess("Enabled")
)

// Mapping from string to FactoryProperties_PublicNetworkAccess
var factoryProperties_PublicNetworkAccess_Values = map[string]FactoryProperties_PublicNetworkAccess{
	"disabled": FactoryProperties_PublicNetworkAccess_Disabled,
	"enabled":  FactoryProperties_PublicNetworkAccess_Enabled,
}

type FactoryRepoConfiguration struct {
	// FactoryGitHub: Mutually exclusive with all other properties
	FactoryGitHub *FactoryGitHubConfiguration `json:"factoryGitHubConfiguration,omitempty"`

	// FactoryVSTS: Mutually exclusive with all other properties
	FactoryVSTS *FactoryVSTSConfiguration `json:"factoryVSTSConfiguration,omitempty"`
}

// MarshalJSON defers JSON marshaling to the first non-nil property, because FactoryRepoConfiguration represents a discriminated union (JSON OneOf)
func (configuration FactoryRepoConfiguration) MarshalJSON() ([]byte, error) {
	if configuration.FactoryGitHub != nil {
		return json.Marshal(configuration.FactoryGitHub)
	}

	if configuration.FactoryVSTS != nil {
		return json.Marshal(configuration.FactoryVSTS)
	}

	return nil, nil
}

// UnmarshalJSON unmarshals the FactoryRepoConfiguration
func (configuration *FactoryRepoConfiguration) UnmarshalJSON(data []byte) error {
	var rawJson map[string]interface{}
	err := json.Unmarshal(data, &rawJson)
	if err != nil {
		return err
	}
	discriminator := rawJson["type"]
	if discriminator == "FactoryGitHubConfiguration" {
		configuration.FactoryGitHub = &FactoryGitHubConfiguration{}
		return json.Unmarshal(data, configuration.FactoryGitHub)
	}
	if discriminator == "FactoryVSTSConfiguration" {
		configuration.FactoryVSTS = &FactoryVSTSConfiguration{}
		return json.Unmarshal(data, configuration.FactoryVSTS)
	}

	// No error
	return nil
}

// Definition of a single parameter for an entity.
type GlobalParameterSpecification struct {
	// Type: Global Parameter type.
	Type *GlobalParameterSpecification_Type `json:"type,omitempty"`

	// Value: Value of parameter.
	Value map[string]v1.JSON `json:"value,omitempty"`
}

// Purview configuration.
type PurviewConfiguration struct {
	// PurviewResourceId: Purview resource id.
	PurviewResourceId *string `json:"purviewResourceId,omitempty"`
}

// Information about the user assigned identity for the resource
type UserAssignedIdentityDetails struct {
}

// Managed Identity used for CMK.
type CMKIdentityDefinition struct {
	// UserAssignedIdentity: The resource id of the user assigned identity to authenticate to customer's key vault.
	UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"`
}

type FactoryGitHubConfiguration struct {
	// AccountName: Account name.
	AccountName *string `json:"accountName,omitempty"`

	// ClientId: GitHub bring your own app client id.
	ClientId *string `json:"clientId,omitempty"`

	// ClientSecret: GitHub bring your own app client secret information.
	ClientSecret *GitHubClientSecret `json:"clientSecret,omitempty"`

	// CollaborationBranch: Collaboration branch.
	CollaborationBranch *string `json:"collaborationBranch,omitempty"`

	// DisablePublish: Disable manual publish operation in ADF studio to favor automated publish.
	DisablePublish *bool `json:"disablePublish,omitempty"`

	// HostName: GitHub Enterprise host name. For example: `https://github.mydomain.com`
	HostName *string `json:"hostName,omitempty"`

	// LastCommitId: Last commit id.
	LastCommitId *string `json:"lastCommitId,omitempty"`

	// RepositoryName: Repository name.
	RepositoryName *string `json:"repositoryName,omitempty"`

	// RootFolder: Root folder.
	RootFolder *string `json:"rootFolder,omitempty"`

	// Type: Type of repo configuration.
	Type FactoryGitHubConfiguration_Type `json:"type,omitempty"`
}

type FactoryVSTSConfiguration struct {
	// AccountName: Account name.
	AccountName *string `json:"accountName,omitempty"`

	// CollaborationBranch: Collaboration branch.
	CollaborationBranch *string `json:"collaborationBranch,omitempty"`

	// DisablePublish: Disable manual publish operation in ADF studio to favor automated publish.
	DisablePublish *bool `json:"disablePublish,omitempty"`

	// LastCommitId: Last commit id.
	LastCommitId *string `json:"lastCommitId,omitempty"`

	// ProjectName: VSTS project name.
	ProjectName *string `json:"projectName,omitempty"`

	// RepositoryName: Repository name.
	RepositoryName *string `json:"repositoryName,omitempty"`

	// RootFolder: Root folder.
	RootFolder *string `json:"rootFolder,omitempty"`

	// TenantId: VSTS tenant id.
	TenantId *string `json:"tenantId,omitempty"`

	// Type: Type of repo configuration.
	Type FactoryVSTSConfiguration_Type `json:"type,omitempty"`
}

// +kubebuilder:validation:Enum={"Array","Bool","Float","Int","Object","String"}
type GlobalParameterSpecification_Type string

const (
	GlobalParameterSpecification_Type_Array  = GlobalParameterSpecification_Type("Array")
	GlobalParameterSpecification_Type_Bool   = GlobalParameterSpecification_Type("Bool")
	GlobalParameterSpecification_Type_Float  = GlobalParameterSpecification_Type("Float")
	GlobalParameterSpecification_Type_Int    = GlobalParameterSpecification_Type("Int")
	GlobalParameterSpecification_Type_Object = GlobalParameterSpecification_Type("Object")
	GlobalParameterSpecification_Type_String = GlobalParameterSpecification_Type("String")
)

// Mapping from string to GlobalParameterSpecification_Type
var globalParameterSpecification_Type_Values = map[string]GlobalParameterSpecification_Type{
	"array":  GlobalParameterSpecification_Type_Array,
	"bool":   GlobalParameterSpecification_Type_Bool,
	"float":  GlobalParameterSpecification_Type_Float,
	"int":    GlobalParameterSpecification_Type_Int,
	"object": GlobalParameterSpecification_Type_Object,
	"string": GlobalParameterSpecification_Type_String,
}

// +kubebuilder:validation:Enum={"FactoryGitHubConfiguration"}
type FactoryGitHubConfiguration_Type string

const FactoryGitHubConfiguration_Type_FactoryGitHubConfiguration = FactoryGitHubConfiguration_Type("FactoryGitHubConfiguration")

// Mapping from string to FactoryGitHubConfiguration_Type
var factoryGitHubConfiguration_Type_Values = map[string]FactoryGitHubConfiguration_Type{
	"factorygithubconfiguration": FactoryGitHubConfiguration_Type_FactoryGitHubConfiguration,
}

// +kubebuilder:validation:Enum={"FactoryVSTSConfiguration"}
type FactoryVSTSConfiguration_Type string

const FactoryVSTSConfiguration_Type_FactoryVSTSConfiguration = FactoryVSTSConfiguration_Type("FactoryVSTSConfiguration")

// Mapping from string to FactoryVSTSConfiguration_Type
var factoryVSTSConfiguration_Type_Values = map[string]FactoryVSTSConfiguration_Type{
	"factoryvstsconfiguration": FactoryVSTSConfiguration_Type_FactoryVSTSConfiguration,
}

// Client secret information for factory's bring your own app repository configuration.
type GitHubClientSecret struct {
	// ByoaSecretAkvUrl: Bring your own app client secret AKV URL.
	ByoaSecretAkvUrl *string `json:"byoaSecretAkvUrl,omitempty"`

	// ByoaSecretName: Bring your own app client secret name in AKV.
	ByoaSecretName *string `json:"byoaSecretName,omitempty"`
}
