/* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*
*  Licensed to Elasticsearch B.V. under one or more contributor
*  license agreements. See the NOTICE file distributed with
*  this work for additional information regarding copyright
*  ownership. Elasticsearch B.V. licenses this file to you under
*  the Apache License, Version 2.0 (the "License"); you may
*  not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
* 	http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing,
*  software distributed under the License is distributed on an
*  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
*  KIND, either express or implied.  See the License for the
*  specific language governing permissions and limitations
*  under the License.
*/
using System;
using System.Runtime.Serialization;
using OpenSearch.Net.Utf8Json;
namespace OpenSearch.Client.Specification.SnapshotApi
{
	/// 
	/// A snapshot repository that stores snapshots in an Azure storage account
	/// 
	/// Requires the repository-azure plugin to be installed on the cluster
	/// 
	public interface IAzureRepository : IRepository { }
	/// 
	public class AzureRepository : IAzureRepository
	{
		public AzureRepository() { }
		public AzureRepository(IAzureRepositorySettings settings) => Settings = settings;
		public IAzureRepositorySettings Settings { get; set; }
		object IRepositoryWithSettings.DelegateSettings => Settings;
		public string Type { get; } = "azure";
	}
	/// 
	/// Snapshot repository settings for 
	/// 
	public interface IAzureRepositorySettings : IRepositorySettings
	{
		/// 
		/// The path within the container on which to store the snapshot data.
		/// 
		[DataMember(Name ="base_path")]
		string BasePath { get; set; }
		/// 
		///  Big files can be broken down into chunks during the snapshot process, if needed.
		///  The chunk size can be specified in bytes or by using size value notation,
		///  i.e. 1g, 10m, 5k. Defaults to 64m (64m max)
		/// 
		[DataMember(Name ="chunk_size")]
		string ChunkSize { get; set; }
		/// 
		/// When set to true metadata files are stored in compressed format. This setting doesn't
		/// affect index files that are already compressed by default. Defaults to false.
		/// 
		[DataMember(Name ="compress")]
		[JsonFormatter(typeof(NullableStringBooleanFormatter))]
		bool? Compress { get; set; }
		/// 
		/// Tha name of the container
		/// 
		[DataMember(Name ="container")]
		string Container { get; set; }
	}
	/// 
	public class AzureRepositorySettings : IAzureRepositorySettings
	{
		/// 
		[DataMember(Name ="base_path")]
		public string BasePath { get; set; }
		/// 
		[DataMember(Name ="chunk_size")]
		public string ChunkSize { get; set; }
		/// 
		[DataMember(Name ="compress")]
		public bool? Compress { get; set; }
		/// 
		[DataMember(Name ="container")]
		public string Container { get; set; }
	}
	public class AzureRepositorySettingsDescriptor
		: DescriptorBase, IAzureRepositorySettings
	{
		string IAzureRepositorySettings.BasePath { get; set; }
		string IAzureRepositorySettings.ChunkSize { get; set; }
		bool? IAzureRepositorySettings.Compress { get; set; }
		string IAzureRepositorySettings.Container { get; set; }
		/// 
		public AzureRepositorySettingsDescriptor Container(string container) => Assign(container, (a, v) => a.Container = v);
		/// 
		public AzureRepositorySettingsDescriptor BasePath(string basePath) => Assign(basePath, (a, v) => a.BasePath = v);
		/// 
		public AzureRepositorySettingsDescriptor Compress(bool? compress = true) => Assign(compress, (a, v) => a.Compress = v);
		/// 
		public AzureRepositorySettingsDescriptor ChunkSize(string chunkSize) => Assign(chunkSize, (a, v) => a.ChunkSize = v);
	}
	/// 
	public class AzureRepositoryDescriptor
		: DescriptorBase, IAzureRepository
	{
		IAzureRepositorySettings IRepository.Settings { get; set; }
		string ISnapshotRepository.Type { get; } = "azure";
		object IRepositoryWithSettings.DelegateSettings => Self.Settings;
		/// 
		public AzureRepositoryDescriptor Settings(Func settingsSelector) =>
			Assign(settingsSelector, (a, v) => a.Settings = v?.Invoke(new AzureRepositorySettingsDescriptor()));
	}
}