# Copyright (c) 2012-2018, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.

from . import AWSObject, AWSProperty, Tags
from .validators import boolean, integer


class UpdateError(AWSProperty):
    props = {
        "ErrorCode": (str, False),
        "ErrorMessage": (str, False),
    }


class LastUpdate(AWSProperty):
    props = {
        "CreatedAt": (str, False),
        "Error": (UpdateError, False),
        "Status": (str, False),
    }


class ModuleLoggingConfiguration(AWSProperty):
    props = {
        "CloudWatchLogGroupArn": (str, False),
        "Enabled": (boolean, False),
        "LogLevel": (str, False),
    }


class LoggingConfiguration(AWSProperty):
    props = {
        "DagProcessingLogs": (ModuleLoggingConfiguration, False),
        "SchedulerLogs": (ModuleLoggingConfiguration, False),
        "TaskLogs": (ModuleLoggingConfiguration, False),
        "WebserverLogs": (ModuleLoggingConfiguration, False),
        "WorkerLogs": (ModuleLoggingConfiguration, False),
    }


class NetworkConfiguration(AWSProperty):
    props = {
        "SecurityGroupIds": (list, True),
        "SubnetIds": (list, True),
    }


class Environment(AWSObject):
    resource_type = "AWS::MWAA::Environment"

    props = {
        "AirflowConfigurationOptions": (str, False),
        "AirflowVersion": (str, False),
        "DagS3Path": (str, True),
        "EnvironmentClass": (str, False),
        "ExecutionRoleArn": (str, True),
        "KmsKey": (str, False),
        "LoggingConfiguration": (LoggingConfiguration, False),
        "MaxWorkers": (integer, False),
        "NetworkConfiguration": (NetworkConfiguration, True),
        "PluginsS3ObjectVersion": (str, False),
        "PluginsS3Path": (str, False),
        "RequirementsS3ObjectVersion": (str, False),
        "RequirementsS3Path": (str, False),
        "SourceBucketArn": (str, True),
        "WebserverAccessMode": (str, False),
        "WebserverUrl": (str, False),
        "WeeklyMaintenanceWindowStart": (str, False),
        "Name": (str, True),
        "Tags": (Tags, False),
    }

@@ -1303,27 +1303,28 @@
 nOptions%22: (
-str
+dict
 , False),%0A  
@@ -1380,35 +1380,36 @@
 gS3Path%22: (str, 
-Tru
+Fals
 e),%0A        %22Env
@@ -1464,35 +1464,36 @@
 RoleArn%22: (str, 
-Tru
+Fals
 e),%0A        %22Kms
@@ -1607,32 +1607,101 @@
 nteger, False),%0A
+        %22MinWorkers%22: (integer, False),%0A        %22Name%22: (str, True),%0A
         %22Network
@@ -1739,19 +1739,20 @@
 ration, 
-Tru
+Fals
 e),%0A    
@@ -1956,35 +1956,36 @@
 cketArn%22: (str, 
-Tru
+Fals
 e),%0A        %22Web
@@ -1985,34 +1985,20 @@
    %22
-WebserverAccessMode%22: (str
+Tags%22: (Tags
 , Fa
@@ -2025,11 +2025,18 @@
 rver
-Url
+AccessMode
 %22: (
@@ -2106,68 +2106,8 @@
 e),%0A
-        %22Name%22: (str, True),%0A        %22Tags%22: (Tags, False),%0A
     

Update MWAA per 2021-04-15 changes