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

import "encoding/json"

type Database_STATUS struct {
	// Name: The name of the resource
	Name *string `conversion:"pushtoleaf" json:"name,omitempty"`

	// ReadWrite: Mutually exclusive with all other properties
	ReadWrite *ReadWriteDatabase_STATUS `json:"readWrite,omitempty"`
}

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

	return nil, nil
}

// UnmarshalJSON unmarshals the Database_STATUS
func (database *Database_STATUS) UnmarshalJSON(data []byte) error {
	var rawJson map[string]interface{}
	err := json.Unmarshal(data, &rawJson)
	if err != nil {
		return err
	}
	discriminator := rawJson["kind"]
	if discriminator == "ReadWrite" {
		database.ReadWrite = &ReadWriteDatabase_STATUS{}
		return json.Unmarshal(data, database.ReadWrite)
	}

	// No error
	return nil
}

type ReadWriteDatabase_STATUS struct {
	// Id: Fully qualified resource ID for the resource. Ex -
	// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	Id *string `json:"id,omitempty"`

	// Kind: Kind of the database
	Kind ReadWriteDatabase_Kind_STATUS `json:"kind,omitempty"`

	// Location: Resource location.
	Location *string `json:"location,omitempty"`

	// Name: The name of the resource
	Name *string `conversion:"noarmconversion" json:"name,omitempty"`

	// Properties: The database properties.
	Properties *ReadWriteDatabaseProperties_STATUS `json:"properties,omitempty"`

	// Type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string `json:"type,omitempty"`
}

type ReadWriteDatabase_Kind_STATUS string

const ReadWriteDatabase_Kind_STATUS_ReadWrite = ReadWriteDatabase_Kind_STATUS("ReadWrite")

// Mapping from string to ReadWriteDatabase_Kind_STATUS
var readWriteDatabase_Kind_STATUS_Values = map[string]ReadWriteDatabase_Kind_STATUS{
	"readwrite": ReadWriteDatabase_Kind_STATUS_ReadWrite,
}

// Class representing the Kusto database properties.
type ReadWriteDatabaseProperties_STATUS struct {
	// HotCachePeriod: The time the data should be kept in cache for fast queries in TimeSpan.
	HotCachePeriod *string `json:"hotCachePeriod,omitempty"`

	// IsFollowed: Indicates whether the database is followed.
	IsFollowed *bool `json:"isFollowed,omitempty"`

	// KeyVaultProperties: KeyVault properties for the database encryption.
	KeyVaultProperties *KeyVaultProperties_STATUS `json:"keyVaultProperties,omitempty"`

	// ProvisioningState: The provisioned state of the resource.
	ProvisioningState *ProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// SoftDeletePeriod: The time the data should be kept before it stops being accessible to queries in TimeSpan.
	SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"`

	// Statistics: The statistics of the database.
	Statistics *DatabaseStatistics_STATUS `json:"statistics,omitempty"`

	// SuspensionDetails: The database suspension details. If the database is suspended, this object contains information
	// related to the database's suspension state.
	SuspensionDetails *SuspensionDetails_STATUS `json:"suspensionDetails,omitempty"`
}

// A class that contains database statistics information.
type DatabaseStatistics_STATUS struct {
	// Size: The database size - the total size of compressed data and index in bytes.
	Size *float64 `json:"size,omitempty"`
}

// The database suspension details. If the database is suspended, this object contains information related to the
// database's suspension state.
type SuspensionDetails_STATUS struct {
	// SuspensionStartDate: The starting date and time of the suspension state.
	SuspensionStartDate *string `json:"suspensionStartDate,omitempty"`
}
