import * as HttpClient from "effect/unstable/http/HttpClient";
import * as redacted from "effect/Redacted";
import * as S from "effect/Schema";
import * as API from "../client/api.js";
import * as T from "../traits.js";
import * as C from "../category.js";
import { SensitiveString } from "../sensitive.js";
const svc = T.AwsApiService({
    sdkId: "Geo Maps",
    serviceShapeName: "MapsService",
});
const auth = T.AwsAuthSigv4({ name: "geo-maps" });
const ver = T.ServiceVersion("2020-11-19");
const proto = T.AwsProtocolsRestJson1();
const rules = T.EndpointResolver((p, _) => {
    const { UseDualStack = false, UseFIPS = false, Endpoint, Region } = p;
    const e = (u, p = {}, h = {}) => ({
        type: "endpoint",
        endpoint: { url: u, properties: p, headers: h },
    });
    const err = (m) => ({
        type: "error",
        message: m,
    });
    if (Endpoint != null) {
        if (UseFIPS === true) {
            return err("Invalid Configuration: FIPS and custom endpoint are not supported");
        }
        if (UseDualStack === true) {
            return err("Invalid Configuration: Dualstack and custom endpoint are not supported");
        }
        return e(Endpoint);
    }
    if (Region != null) {
        {
            const PartitionResult = _.partition(Region);
            if (PartitionResult != null && PartitionResult !== false) {
                if (_.getAttr(PartitionResult, "name") === "aws" &&
                    UseFIPS === false &&
                    UseDualStack === false) {
                    return e(`https://maps.geo.${Region}.${_.getAttr(PartitionResult, "dnsSuffix")}/v2`);
                }
                if (_.getAttr(PartitionResult, "name") === "aws" &&
                    UseFIPS === true &&
                    UseDualStack === true) {
                    return e(`https://maps.geo-fips.${Region}.${_.getAttr(PartitionResult, "dualStackDnsSuffix")}/v2`);
                }
                if (_.getAttr(PartitionResult, "name") === "aws" &&
                    UseFIPS === true &&
                    UseDualStack === false) {
                    return e(`https://maps.geo-fips.${Region}.${_.getAttr(PartitionResult, "dnsSuffix")}/v2`);
                }
                if (_.getAttr(PartitionResult, "name") === "aws" &&
                    UseFIPS === false &&
                    UseDualStack === true) {
                    return e(`https://maps.geo.${Region}.${_.getAttr(PartitionResult, "dualStackDnsSuffix")}/v2`);
                }
                if (_.getAttr(PartitionResult, "name") === "aws-us-gov" &&
                    UseFIPS === false &&
                    UseDualStack === false) {
                    return e(`https://maps.geo.${Region}.${_.getAttr(PartitionResult, "dnsSuffix")}/v2`);
                }
                if (_.getAttr(PartitionResult, "name") === "aws-us-gov" &&
                    UseFIPS === true &&
                    UseDualStack === true) {
                    return e(`https://maps.geo-fips.${Region}.${_.getAttr(PartitionResult, "dualStackDnsSuffix")}/v2`);
                }
                if (_.getAttr(PartitionResult, "name") === "aws-us-gov" &&
                    UseFIPS === true &&
                    UseDualStack === false) {
                    return e(`https://maps.geo-fips.${Region}.${_.getAttr(PartitionResult, "dnsSuffix")}/v2`);
                }
                if (_.getAttr(PartitionResult, "name") === "aws-us-gov" &&
                    UseFIPS === false &&
                    UseDualStack === true) {
                    return e(`https://maps.geo.${Region}.${_.getAttr(PartitionResult, "dualStackDnsSuffix")}/v2`);
                }
                if (UseFIPS === true && UseDualStack === true) {
                    if (true === _.getAttr(PartitionResult, "supportsFIPS") &&
                        true === _.getAttr(PartitionResult, "supportsDualStack")) {
                        return e(`https://geo-maps-fips.${Region}.${_.getAttr(PartitionResult, "dualStackDnsSuffix")}`);
                    }
                    return err("FIPS and DualStack are enabled, but this partition does not support one or both");
                }
                if (UseFIPS === true && UseDualStack === false) {
                    if (_.getAttr(PartitionResult, "supportsFIPS") === true) {
                        return e(`https://geo-maps-fips.${Region}.${_.getAttr(PartitionResult, "dnsSuffix")}`);
                    }
                    return err("FIPS is enabled but this partition does not support FIPS");
                }
                if (UseFIPS === false && UseDualStack === true) {
                    if (true === _.getAttr(PartitionResult, "supportsDualStack")) {
                        return e(`https://geo-maps.${Region}.${_.getAttr(PartitionResult, "dualStackDnsSuffix")}`);
                    }
                    return err("DualStack is enabled but this partition does not support DualStack");
                }
                return e(`https://geo-maps.${Region}.${_.getAttr(PartitionResult, "dnsSuffix")}`);
            }
        }
    }
    return err("Invalid Configuration: Missing Region");
});
export const GetGlyphsRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    FontStack: S.String.pipe(T.HttpLabel("FontStack")),
    FontUnicodeRange: S.String.pipe(T.HttpLabel("FontUnicodeRange")),
}).pipe(T.all(T.Http({ method: "GET", uri: "/glyphs/{FontStack}/{FontUnicodeRange}" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "GetGlyphsRequest",
});
export const GetGlyphsResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Blob: S.optional(T.Blob).pipe(T.HttpPayload()),
    ContentType: S.optional(S.String).pipe(T.HttpHeader("Content-Type")),
    CacheControl: S.optional(S.String).pipe(T.HttpHeader("Cache-Control")),
    ETag: S.optional(S.String).pipe(T.HttpHeader("ETag")),
})).annotate({
    identifier: "GetGlyphsResponse",
});
export const GetSpritesRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    FileName: S.String.pipe(T.HttpLabel("FileName")),
    Style: S.String.pipe(T.HttpLabel("Style")),
    ColorScheme: S.String.pipe(T.HttpLabel("ColorScheme")),
    Variant: S.String.pipe(T.HttpLabel("Variant")),
}).pipe(T.all(T.Http({
    method: "GET",
    uri: "/styles/{Style}/{ColorScheme}/{Variant}/sprites/{FileName}",
}), svc, auth, proto, ver, rules))).annotate({
    identifier: "GetSpritesRequest",
});
export const GetSpritesResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Blob: S.optional(T.Blob).pipe(T.HttpPayload()),
    ContentType: S.optional(S.String).pipe(T.HttpHeader("Content-Type")),
    CacheControl: S.optional(S.String).pipe(T.HttpHeader("Cache-Control")),
    ETag: S.optional(S.String).pipe(T.HttpHeader("ETag")),
})).annotate({
    identifier: "GetSpritesResponse",
});
export const GetStaticMapRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    BoundingBox: S.optional(SensitiveString).pipe(T.HttpQuery("bounding-box")),
    BoundedPositions: S.optional(SensitiveString).pipe(T.HttpQuery("bounded-positions")),
    Center: S.optional(SensitiveString).pipe(T.HttpQuery("center")),
    ColorScheme: S.optional(S.String).pipe(T.HttpQuery("color-scheme")),
    CompactOverlay: S.optional(SensitiveString).pipe(T.HttpQuery("compact-overlay")),
    CropLabels: S.optional(S.Boolean).pipe(T.HttpQuery("crop-labels")),
    GeoJsonOverlay: S.optional(SensitiveString).pipe(T.HttpQuery("geojson-overlay")),
    Height: S.Number.pipe(T.HttpQuery("height")),
    Key: S.optional(SensitiveString).pipe(T.HttpQuery("key")),
    LabelSize: S.optional(S.String).pipe(T.HttpQuery("label-size")),
    Language: S.optional(S.String).pipe(T.HttpQuery("lang")),
    Padding: S.optional(S.Number).pipe(T.HttpQuery("padding")),
    PoliticalView: S.optional(SensitiveString).pipe(T.HttpQuery("political-view")),
    PointsOfInterests: S.optional(S.String).pipe(T.HttpQuery("pois")),
    Radius: S.optional(S.Number).pipe(T.HttpQuery("radius")),
    FileName: S.String.pipe(T.HttpLabel("FileName")),
    ScaleBarUnit: S.optional(S.String).pipe(T.HttpQuery("scale-unit")),
    Style: S.optional(S.String).pipe(T.HttpQuery("style")),
    Width: S.Number.pipe(T.HttpQuery("width")),
    Zoom: S.optional(S.Number).pipe(T.HttpQuery("zoom")),
}).pipe(T.all(T.Http({ method: "GET", uri: "/static/{FileName}" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "GetStaticMapRequest",
});
export const GetStaticMapResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Blob: S.optional(T.Blob).pipe(T.HttpPayload()),
    ContentType: S.optional(S.String).pipe(T.HttpHeader("Content-Type")),
    CacheControl: S.optional(S.String).pipe(T.HttpHeader("Cache-Control")),
    ETag: S.optional(S.String).pipe(T.HttpHeader("ETag")),
    PricingBucket: S.String.pipe(T.HttpHeader("x-amz-geo-pricing-bucket")),
})).annotate({
    identifier: "GetStaticMapResponse",
});
export const ValidationExceptionField = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ Name: S.String, Message: S.String }).pipe(S.encodeKeys({ Name: "name", Message: "message" }))).annotate({
    identifier: "ValidationExceptionField",
});
export const ValidationExceptionFieldList = /*@__PURE__*/ /*#__PURE__*/ S.Array(ValidationExceptionField);
export const TravelModeList = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const GetStyleDescriptorRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Style: S.String.pipe(T.HttpLabel("Style")),
    ColorScheme: S.optional(S.String).pipe(T.HttpQuery("color-scheme")),
    PoliticalView: S.optional(SensitiveString).pipe(T.HttpQuery("political-view")),
    Terrain: S.optional(S.String).pipe(T.HttpQuery("terrain")),
    ContourDensity: S.optional(S.String).pipe(T.HttpQuery("contour-density")),
    Traffic: S.optional(S.String).pipe(T.HttpQuery("traffic")),
    TravelModes: S.optional(TravelModeList).pipe(T.HttpQuery("travel-modes")),
    Buildings: S.optional(S.String).pipe(T.HttpQuery("buildings")),
    Key: S.optional(SensitiveString).pipe(T.HttpQuery("key")),
}).pipe(T.all(T.Http({ method: "GET", uri: "/styles/{Style}/descriptor" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "GetStyleDescriptorRequest",
});
export const GetStyleDescriptorResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Blob: S.optional(T.Blob).pipe(T.HttpPayload()),
    ContentType: S.optional(S.String).pipe(T.HttpHeader("Content-Type")),
    CacheControl: S.optional(S.String).pipe(T.HttpHeader("Cache-Control")),
    ETag: S.optional(S.String).pipe(T.HttpHeader("ETag")),
})).annotate({
    identifier: "GetStyleDescriptorResponse",
});
export const TileAdditionalFeatureList = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const GetTileRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    AdditionalFeatures: S.optional(TileAdditionalFeatureList).pipe(T.HttpQuery("additional-features")),
    Tileset: S.String.pipe(T.HttpLabel("Tileset")),
    Z: SensitiveString.pipe(T.HttpLabel("Z")),
    X: SensitiveString.pipe(T.HttpLabel("X")),
    Y: SensitiveString.pipe(T.HttpLabel("Y")),
    Key: S.optional(SensitiveString).pipe(T.HttpQuery("key")),
}).pipe(T.all(T.Http({ method: "GET", uri: "/tiles/{Tileset}/{Z}/{X}/{Y}" }), svc, auth, proto, ver, rules))).annotate({ identifier: "GetTileRequest" });
export const GetTileResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Blob: S.optional(T.Blob).pipe(T.HttpPayload()),
    ContentType: S.optional(S.String).pipe(T.HttpHeader("Content-Type")),
    CacheControl: S.optional(S.String).pipe(T.HttpHeader("Cache-Control")),
    ETag: S.optional(S.String).pipe(T.HttpHeader("ETag")),
    PricingBucket: S.String.pipe(T.HttpHeader("x-amz-geo-pricing-bucket")),
})).annotate({
    identifier: "GetTileResponse",
});
//# Errors
export class AccessDeniedException extends S.TaggedErrorClass()("AccessDeniedException", { Message: S.String }).pipe(C.withAuthError) {
}
export class InternalServerException extends S.TaggedErrorClass()("InternalServerException", { Message: S.String }, T.Retryable()).pipe(C.withServerError, C.withRetryableError) {
}
export class ThrottlingException extends S.TaggedErrorClass()("ThrottlingException", { Message: S.String }, T.Retryable()).pipe(C.withThrottlingError, C.withRetryableError) {
}
export class ValidationException extends S.TaggedErrorClass()("ValidationException", {
    Message: S.String,
    Reason: S.String,
    FieldList: ValidationExceptionFieldList,
}).pipe(C.withBadRequestError) {
}
export class ResourceNotFoundException extends S.TaggedErrorClass()("ResourceNotFoundException", { Message: S.String }).pipe(C.withBadRequestError) {
}
/**
 * `GetGlyphs` returns the map's glyphs.
 *
 * For more information, see Style labels with glyphs in the *Amazon Location Service Developer Guide*.
 */
export const getGlyphs = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetGlyphsRequest,
    output: GetGlyphsResponse,
    errors: [],
}));
/**
 * `GetSprites` returns the map's sprites.
 *
 * For more information, see Style iconography with sprites in the *Amazon Location Service Developer Guide*.
 */
export const getSprites = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetSpritesRequest,
    output: GetSpritesResponse,
    errors: [],
}));
/**
 * This operation is not supported in `ap-southeast-1` and `ap-southeast-5` regions for GrabMaps customers.
 *
 * `GetStaticMap` provides high-quality static map images with customizable options. You can modify the map's appearance and overlay additional information. It's an ideal solution for applications requiring tailored static map snapshots.
 *
 * For more information, see the following topics in the *Amazon Location Service Developer Guide*:
 *
 * - Static maps
 *
 * - Customize static maps
 *
 * - Overlay on the static map
 */
export const getStaticMap = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetStaticMapRequest,
    output: GetStaticMapResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * `GetStyleDescriptor` returns information about the style.
 *
 * For more information, see Style dynamic maps in the *Amazon Location Service Developer Guide*.
 */
export const getStyleDescriptor = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetStyleDescriptorRequest,
    output: GetStyleDescriptorResponse,
    errors: [],
}));
/**
 * `GetTile` returns a tile. Map tiles are used by clients to render a map. They're addressed using a grid arrangement with an X coordinate, Y coordinate, and Z (zoom) level.
 *
 * For more information, see Tiles in the *Amazon Location Service Developer Guide*.
 */
export const getTile = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetTileRequest,
    output: GetTileResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ResourceNotFoundException,
        ThrottlingException,
        ValidationException,
    ],
}));
//# sourceMappingURL=geo-maps.js.map