"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""

import cfnlint.data.schemas.extensions.aws_ec2_instance
from cfnlint.rules.jsonschema.CfnLintJsonSchema import SchemaDetails
from cfnlint.rules.jsonschema.CfnLintJsonSchemaRegional import CfnLintJsonSchemaRegional


class InstanceInstanceTypeEnum(CfnLintJsonSchemaRegional):
    id = "E3628"
    shortdesc = "Validate EC2 instance types based on region"
    description = (
        "Validates the EC2 instance types based on region "
        "and data gathered from the pricing APIs"
    )
    tags = ["resources"]

    def __init__(self) -> None:
        super().__init__(
            keywords=[
                "Resources/AWS::EC2::Instance/Properties/InstanceType",
                "Resources/AWS::EC2::LaunchTemplate/Properties/LaunchTemplateData/InstanceType",
                "Resources/AWS::EC2::EC2Fleet/Properties/LaunchTemplateConfigs/*/Overrides/*/InstanceType",
                "Resources/AWS::EC2::CapacityReservationFleet/Properties/InstanceTypeSpecifications/*/InstanceType",
                "Resources/AWS::GameLift::GameServerGroup/Properties/InstanceDefinitions/*/InstanceType",
            ],
            schema_details=SchemaDetails(
                module=cfnlint.data.schemas.extensions.aws_ec2_instance,
                filename="instancetype_enum.json",
            ),
        )
