// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Immutable;

namespace Pulumi.Configstation
{
    public static class Config
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "IDE1006", Justification = 
        "Double underscore prefix used to avoid conflicts with variable names.")]
        private sealed class __Value<T>
        {
            private readonly Func<T> _getter;
            private T _value = default!;
            private bool _set;

            public __Value(Func<T> getter)
            {
                _getter = getter;
            }

            public T Get() => _set ? _value : _getter();

            public void Set(T value)
            {
                _value = value;
                _set = true;
            }
        }

        private static readonly Pulumi.Config __config = new Pulumi.Config("configstation");

        private static readonly __Value<ImmutableArray<string>> _favoritePlants = new __Value<ImmutableArray<string>>(() => __config.GetObject<ImmutableArray<string>>("favoritePlants"));
        public static ImmutableArray<string> FavoritePlants
        {
            get => _favoritePlants.Get();
            set => _favoritePlants.Set(value);
        }

        private static readonly __Value<Pulumi.Configstation.Config.Types.Sandwich?> _favoriteSandwich = new __Value<Pulumi.Configstation.Config.Types.Sandwich?>(() => __config.GetObject<Pulumi.Configstation.Config.Types.Sandwich>("favoriteSandwich"));
        /// <summary>
        /// omg my favorite sandwich
        /// </summary>
        public static Pulumi.Configstation.Config.Types.Sandwich? FavoriteSandwich
        {
            get => _favoriteSandwich.Get();
            set => _favoriteSandwich.Set(value);
        }

        private static readonly __Value<bool?> _isMember = new __Value<bool?>(() => __config.GetBoolean("isMember") ?? true);
        public static bool? IsMember
        {
            get => _isMember.Get();
            set => _isMember.Set(value);
        }

        private static readonly __Value<Types.Child?> _kids = new __Value<Types.Child?>(() => __config.GetObject<Types.Child>("kids"));
        public static Types.Child? Kids
        {
            get => _kids.Get();
            set => _kids.Set(value);
        }

        private static readonly __Value<string?> _name = new __Value<string?>(() => __config.Get("name"));
        public static string? Name
        {
            get => _name.Get();
            set => _name.Set(value);
        }

        private static readonly __Value<int?> _numberOfSheep = new __Value<int?>(() => __config.GetInt32("numberOfSheep"));
        public static int? NumberOfSheep
        {
            get => _numberOfSheep.Get();
            set => _numberOfSheep.Set(value);
        }

        private static readonly __Value<string?> _secretCode = new __Value<string?>(() => __config.Get("secretCode") ?? Utilities.GetEnv("SECRET_CODE", "MY_SUPER_SECRET_CODE"));
        /// <summary>
        /// This is a huge secret
        /// </summary>
        public static string? SecretCode
        {
            get => _secretCode.Get();
            set => _secretCode.Set(value);
        }

        public static class Types
        {

             public class Sandwich
             {
                public string? Bread { get; set; } = null!;
                public ImmutableArray<string> Veggies { get; set; }
            }
        }
    }
}
