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


class DataResource(AWSProperty):
    props = {
        "Type": (str, True),
        "Values": ([str], False),
    }


class EventSelector(AWSProperty):
    props = {
        "DataResources": ([DataResource], False),
        "ExcludeManagementEventSources": ([str], False),
        "IncludeManagementEvents": (boolean, False),
        "ReadWriteType": (str, False),
    }


class InsightSelector(AWSProperty):
    props = {
        "InsightType": (str, False),
    }


class Trail(AWSObject):
    resource_type = "AWS::CloudTrail::Trail"

    props = {
        "CloudWatchLogsLogGroupArn": (str, False),
        "CloudWatchLogsRoleArn": (str, False),
        "EnableLogFileValidation": (boolean, False),
        "EventSelectors": ([EventSelector], False),
        "IncludeGlobalServiceEvents": (boolean, False),
        "InsightSelectors": ([InsightSelector], False),
        "IsLogging": (boolean, True),
        "IsMultiRegionTrail": (boolean, False),
        "IsOrganizationTrail": (boolean, False),
        "KMSKeyId": (str, False),
        "S3BucketName": (str, True),
        "S3KeyPrefix": (str, False),
        "SnsTopicName": (str, False),
        "Tags": (Tags, False),
        "TrailName": (str, False),
    }

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


class DataResource(AWSProperty):
    props = {
        "Type": (str, True),
        "Values": ([str], False),
    }


class EventSelector(AWSProperty):
    props = {
        "DataResources": ([DataResource], False),
        "IncludeManagementEvents": (boolean, False),
        "ReadWriteType": (str, False),
    }


class Trail(AWSObject):
    resource_type = "AWS::CloudTrail::Trail"

    props = {
        "CloudWatchLogsLogGroupArn": (str, False),
        "CloudWatchLogsRoleArn": (str, False),
        "EnableLogFileValidation": (boolean, False),
        "EventSelectors": ([EventSelector], False),
        "IncludeGlobalServiceEvents": (boolean, False),
        "IsLogging": (boolean, True),
        "IsMultiRegionTrail": (boolean, False),
        "KMSKeyId": (str, False),
        "S3BucketName": (str, True),
        "S3KeyPrefix": (str, False),
        "SnsTopicName": (str, False),
        "Tags": (Tags, False),
        "TrailName": (str, False),
    }

--- 
+++ 
@@ -12,8 +12,15 @@
 class EventSelector(AWSProperty):
     props = {
         "DataResources": ([DataResource], False),
+        "ExcludeManagementEventSources": ([str], False),
         "IncludeManagementEvents": (boolean, False),
         "ReadWriteType": (str, False),
+    }
+
+
+class InsightSelector(AWSProperty):
+    props = {
+        "InsightType": (str, False),
     }
 
 
@@ -26,8 +33,10 @@
         "EnableLogFileValidation": (boolean, False),
         "EventSelectors": ([EventSelector], False),
         "IncludeGlobalServiceEvents": (boolean, False),
+        "InsightSelectors": ([InsightSelector], False),
         "IsLogging": (boolean, True),
         "IsMultiRegionTrail": (boolean, False),
+        "IsOrganizationTrail": (boolean, False),
         "KMSKeyId": (str, False),
         "S3BucketName": (str, True),
         "S3KeyPrefix": (str, False),
Update Cloudtrail per 2021-09-10 changes
