/**
 * Stripe-specific error types.
 *
 * Re-exports common HTTP errors from sdk-core and adds Stripe-specific
 * error matching and API error types.
 */
export { BadGateway, BadRequest, Conflict, ConfigError, Forbidden, GatewayTimeout, InternalServerError, Locked, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, HTTP_STATUS_MAP, DEFAULT_ERRORS, API_ERRORS, } from "@distilled.cloud/core/errors";
import * as Schema from "effect/Schema";
import * as Category from "@distilled.cloud/core/category";
/**
 * Payment error — returned when a payment request fails (HTTP 402).
 * The parameters were valid but the request failed (e.g., card declined).
 */
export class PaymentError extends Schema.TaggedErrorClass()("PaymentError", {
    message: Schema.optional(Schema.String),
    code: Schema.optional(Schema.String),
    decline_code: Schema.optional(Schema.String),
    charge: Schema.optional(Schema.String),
    param: Schema.optional(Schema.String),
    doc_url: Schema.optional(Schema.String),
    request_log_url: Schema.optional(Schema.String),
}).pipe(Category.withBadRequestError) {
}
/**
 * Card error — returned when a card cannot be charged.
 * Stripe error type: "card_error"
 */
export class CardError extends Schema.TaggedErrorClass()("CardError", {
    message: Schema.optional(Schema.String),
    code: Schema.optional(Schema.String),
    decline_code: Schema.optional(Schema.String),
    charge: Schema.optional(Schema.String),
    param: Schema.optional(Schema.String),
    doc_url: Schema.optional(Schema.String),
    advice_code: Schema.optional(Schema.String),
    network_advice_code: Schema.optional(Schema.String),
    network_decline_code: Schema.optional(Schema.String),
    payment_method_type: Schema.optional(Schema.String),
    request_log_url: Schema.optional(Schema.String),
}).pipe(Category.withBadRequestError) {
}
/**
 * Idempotency error — returned when an Idempotency-Key is re-used
 * on a request that does not match the first request's API endpoint and parameters.
 * Stripe error type: "idempotency_error"
 */
export class IdempotencyError extends Schema.TaggedErrorClass()("IdempotencyError", {
    message: Schema.optional(Schema.String),
    code: Schema.optional(Schema.String),
    doc_url: Schema.optional(Schema.String),
    request_log_url: Schema.optional(Schema.String),
}).pipe(Category.withConflictError) {
}
/**
 * Invalid request error — returned when the request has invalid parameters.
 * Stripe error type: "invalid_request_error"
 */
export class InvalidRequestError extends Schema.TaggedErrorClass()("InvalidRequestError", {
    message: Schema.optional(Schema.String),
    code: Schema.optional(Schema.String),
    param: Schema.optional(Schema.String),
    doc_url: Schema.optional(Schema.String),
    request_log_url: Schema.optional(Schema.String),
}).pipe(Category.withBadRequestError) {
}
/**
 * API error — returned when something goes wrong on Stripe's end (HTTP 500+).
 * Stripe error type: "api_error"
 */
export class ApiError extends Schema.TaggedErrorClass()("ApiError", {
    message: Schema.optional(Schema.String),
    code: Schema.optional(Schema.String),
    param: Schema.optional(Schema.String),
    doc_url: Schema.optional(Schema.String),
    request_log_url: Schema.optional(Schema.String),
}).pipe(Category.withServerError, Category.withRetryable()) {
}
/**
 * External dependency failed — returned when an external dependency fails (HTTP 424).
 */
export class ExternalDependencyFailed extends Schema.TaggedErrorClass()("ExternalDependencyFailed", {
    message: Schema.optional(Schema.String),
    code: Schema.optional(Schema.String),
    doc_url: Schema.optional(Schema.String),
}).pipe(Category.withServerError, Category.withRetryable()) {
}
/**
 * Stripe HTTP status code to error class mapping.
 * Extends core HTTP_STATUS_MAP with Stripe-specific statuses.
 */
export const STRIPE_HTTP_STATUS_MAP = {
    402: PaymentError,
    424: ExternalDependencyFailed,
};
// Unknown Stripe error — returned when an error type is not recognized
export class UnknownStripeError extends Schema.TaggedErrorClass()("UnknownStripeError", {
    type: Schema.optional(Schema.String),
    code: Schema.optional(Schema.String),
    message: Schema.optional(Schema.String),
    param: Schema.optional(Schema.String),
    body: Schema.Unknown,
}).pipe(Category.withServerError) {
}
// Schema parse error wrapper
export class StripeParseError extends Schema.TaggedErrorClass()("StripeParseError", {
    body: Schema.Unknown,
    cause: Schema.Unknown,
}).pipe(Category.withParseError) {
}
//# sourceMappingURL=errors.js.map