---
outputs:
    {% for resource in resources %}
    TableName{{loop.index}}:
        Description:
            The name of the DynamoDB table
        Value: {Ref: Table{{loop.index}}}
    {% endfor %}

    {% if dax_subnets %}
    DaxClusterArn:
        Description: The ARN of the DAX cluster
        Value:
            "Fn::GetAtt":
                - DaxCluster
                - Arn

    DaxClusterDiscoveryEndpoint:
        Description: The ARN of the DAX cluster
        Value:
            "Fn::GetAtt":
                - DaxCluster
                - ClusterDiscoveryEndpoint

    {% endif %}

    {% if has_public_api %}
    {% if domain_name and certificate_arn %}
    DomainName:
        Description:
            The domain name associated to the root resource of the API
        Value:
            Ref: DomainName
    {% endif %}

    RestApiId:
        Description:
            The REST API Id
        Value: {Ref: RestApi}

    ApiKey:
        Description:
            The key associated to the REST API {{__context.stage}} deployment
        Value: {Ref: ApiKey}

    RootResourceInvokeUrl:
        Description:
            The invoke URL for the root resource of the API
        Value:
            "Fn::Join":
                - ""
                - ["https://", {Ref: RestApi}, ".execute-api.",
                   {Ref: "AWS::Region"}, ".amazonaws.com/", "{{__context.stage.lower()}}"]
    {% endif %}

    {% for key in client_keys %}
    ApiKey{{key.name.title()}}:
        Description: API Key for client {{key.name}}
        Value:
            Ref: ApiKey{{key.name.title()}}

    UsagePlan{{key.name.title()}}:
        Description: Usage plan for client {{key.name}}
        Value:
            Ref: UsagePlan{{key.name.title()}}
    {% endfor %}
