"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DynamoOrderStatusOrdering = exports.TableIndexNames = exports.TableNames = void 0;
exports.toComparableStatus = toComparableStatus;
const types_1 = require("../order/types");
var TableNames;
(function (TableNames) {
    TableNames["guardianTransitionHistory"] = "guardian-transition-history";
    TableNames["guardianBatchHashes"] = "guardian-batch-hashes";
    TableNames["guardianEscrowOrders"] = "guardian-escrow-orders";
    TableNames["guardianOrders"] = "guardian-orders";
    TableNames["guardianAttestationsPending"] = "guardian-attestations-pending";
    TableNames["guardianAttestationsDLQ"] = "guardian-attestations-dlq";
    TableNames["guardianOrderStats"] = "guardian-order-stats";
    TableNames["guardianChainStats"] = "guardian-chain-stats";
    TableNames["guardianExecutorStats"] = "guardian-executor-stats";
    TableNames["guardianUserStats"] = "guardian-user-stats";
    TableNames["guardianOrdersAccounts"] = "guardian-orders-accounts";
    TableNames["guardianAccountsBalances"] = "guardian-accounts-balances";
    TableNames["guardianTimeseriesStats"] = "guardian-timeseries-stats";
    TableNames["guardianAixecutors"] = "guardian-aixecutors";
    TableNames["guardianBRNSybils"] = "guardian-brn-sybils";
    TableNames["messiah"] = "messiah";
})(TableNames || (exports.TableNames = TableNames = {}));
exports.TableIndexNames = {
    guardianOrders: {
        statusOrderTimestamp: 'status-orderTimestamp',
        status: 'status',
        sourceStatus: 'source-status',
        partitionOrderTimestamp: 'partitionKey-orderTimestamp',
        statusOrderTimestampAll: 'status-orderTimestamp-ALL',
        sourceAccount: 'sourceAccount',
        executorStatus: 'executor-status',
        executorConfirmationTimestamp: 'executor-confirmationTimestamp',
        executorConfirmationTimestampAll: 'executor-confirmationTimestamp-ALL',
        sourceAccountStatus: 'sourceAccount-status',
        sourceAccountStatusAll: 'sourceAccount-status-ALL',
        sourceAccountOrderTimestamp: 'sourceAccount-orderTimestamp',
        sourceAccountOrderTimestampAll: 'sourceAccount-orderTimestamp-ALL',
        txHash: 'txHash',
    },
    guardianExecutorStats: {
        partitionKeyTotalMaxRewardsUSDLastHour: 'partitionKey-totalMaxRewardsUSDLastHour',
        partitionKeyTotalBidsLastHour: 'partitionKey-totalBidsLastHour',
    },
    guardianTimeseriesStats: {
        partitionKeyBucketStartTs: 'partitionKey-bucketStartTs',
        bucketTypeBucketStartTs: 'bucketType-bucketStartTs',
    },
};
var DynamoOrderStatusOrdering;
(function (DynamoOrderStatusOrdering) {
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["Placed"] = 0] = "Placed";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["Pending"] = 1] = "Pending";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["PlacedUnsupportedNetwork"] = 2] = "PlacedUnsupportedNetwork";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["Bid"] = 100] = "Bid";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["InvalidPendingRefund"] = 105] = "InvalidPendingRefund";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["InvalidAttestation"] = 106] = "InvalidAttestation";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["InvalidMissingL2"] = 107] = "InvalidMissingL2";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["GMPUnmoved"] = 108] = "GMPUnmoved";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["GMPReAttest"] = 109] = "GMPReAttest";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["UnknownPossibleMigration"] = 110] = "UnknownPossibleMigration";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["Broken"] = 111] = "Broken";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["UnRefundable"] = 112] = "UnRefundable";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["Duplicated"] = 113] = "Duplicated";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["GMPMismatch"] = 114] = "GMPMismatch";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["Expired"] = 200] = "Expired";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["PendingRefundWaiting"] = 201] = "PendingRefundWaiting";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["PendingRefund"] = 202] = "PendingRefund";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["RefundZeroAddress"] = 203] = "RefundZeroAddress";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["RefundAttested"] = 204] = "RefundAttested";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["MissingExecutor"] = 205] = "MissingExecutor";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["MissingOrderTimestamp"] = 206] = "MissingOrderTimestamp";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["MissingOrderMaxReward"] = 207] = "MissingOrderMaxReward";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["MissingConfirmation"] = 208] = "MissingConfirmation";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["Executed"] = 300] = "Executed";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["AttestedUnsupportedNetwork"] = 400] = "AttestedUnsupportedNetwork";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["AttestedL3"] = 401] = "AttestedL3";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["Attested"] = 402] = "Attested";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["NonClaimable"] = 403] = "NonClaimable";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["ProcessInsurance"] = 404] = "ProcessInsurance";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["ClaimedInsurance"] = 405] = "ClaimedInsurance";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["Claimed"] = 500] = "Claimed";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["ClaimedRefund"] = 501] = "ClaimedRefund";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["ConfirmedRefund"] = 502] = "ConfirmedRefund";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["ToRepatriate"] = 503] = "ToRepatriate";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["Repatriated"] = 504] = "Repatriated";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["PendingIngress"] = 600] = "PendingIngress";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["ResolvedIngress"] = 601] = "ResolvedIngress";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["PendingEgress"] = 602] = "PendingEgress";
    DynamoOrderStatusOrdering[DynamoOrderStatusOrdering["ResolvedEgress"] = 603] = "ResolvedEgress";
})(DynamoOrderStatusOrdering || (exports.DynamoOrderStatusOrdering = DynamoOrderStatusOrdering = {}));
// Achtung: watch out for the default state matching to Broken for unmatched status
function toComparableStatus(dynamoStatus) {
    switch (dynamoStatus) {
        case types_1.OrderStatus.Placed:
            return DynamoOrderStatusOrdering.Placed;
        case types_1.OrderStatus.Pending:
            return DynamoOrderStatusOrdering.Pending;
        case types_1.OrderStatus.Bid:
            return DynamoOrderStatusOrdering.Bid;
        case types_1.OrderStatus.Executed:
            return DynamoOrderStatusOrdering.Executed;
        case types_1.OrderStatus.Expired:
            return DynamoOrderStatusOrdering.Expired;
        case types_1.OrderStatus.MissingExecutor:
            return DynamoOrderStatusOrdering.MissingExecutor;
        case types_1.OrderStatus.MissingConfirmation:
            return DynamoOrderStatusOrdering.MissingConfirmation;
        case types_1.OrderStatus.MissingOrderTimestamp:
            return DynamoOrderStatusOrdering.MissingOrderTimestamp;
        case types_1.OrderStatus.MissingOrderMaxReward:
            return DynamoOrderStatusOrdering.MissingOrderMaxReward;
        case types_1.OrderStatus.AttestedL3:
            return DynamoOrderStatusOrdering.AttestedL3;
        case types_1.OrderStatus.AttestedUnsupportedNetwork:
            return DynamoOrderStatusOrdering.AttestedUnsupportedNetwork;
        case types_1.OrderStatus.PlacedUnsupportedNetwork:
            return DynamoOrderStatusOrdering.PlacedUnsupportedNetwork;
        case types_1.OrderStatus.Attested:
            return DynamoOrderStatusOrdering.Attested;
        case types_1.OrderStatus.Claimed:
            return DynamoOrderStatusOrdering.Claimed;
        case types_1.OrderStatus.ConfirmedRefund:
            return DynamoOrderStatusOrdering.ConfirmedRefund;
        case types_1.OrderStatus.PendingRefund:
            return DynamoOrderStatusOrdering.PendingRefund;
        case types_1.OrderStatus.RefundAttested:
            return DynamoOrderStatusOrdering.RefundAttested;
        case types_1.OrderStatus.RefundZeroAddress:
            return DynamoOrderStatusOrdering.RefundZeroAddress;
        case types_1.OrderStatus.PendingRefundWaiting:
            return DynamoOrderStatusOrdering.PendingRefundWaiting;
        case types_1.OrderStatus.InvalidPendingRefund:
            return DynamoOrderStatusOrdering.InvalidPendingRefund;
        case types_1.OrderStatus.InvalidAttestation:
            return DynamoOrderStatusOrdering.InvalidAttestation;
        case types_1.OrderStatus.NonClaimable:
            return DynamoOrderStatusOrdering.NonClaimable;
        case types_1.OrderStatus.InvalidMissingL2:
            return DynamoOrderStatusOrdering.InvalidMissingL2;
        case types_1.OrderStatus.ClaimedRefund:
            return DynamoOrderStatusOrdering.ClaimedRefund;
        case types_1.OrderStatus.ProcessInsurance:
            return DynamoOrderStatusOrdering.ProcessInsurance;
        case types_1.OrderStatus.ClaimedInsurance:
            return DynamoOrderStatusOrdering.ClaimedInsurance;
        case types_1.OrderStatus.GMPUnmoved:
            return DynamoOrderStatusOrdering.GMPUnmoved;
        case types_1.OrderStatus.GMPReAttest:
            return DynamoOrderStatusOrdering.GMPReAttest;
        case types_1.OrderStatus.GMPMismatch:
            return DynamoOrderStatusOrdering.GMPMismatch;
        case types_1.OrderStatus.UnknownPossibleMigration:
            return DynamoOrderStatusOrdering.UnknownPossibleMigration;
        case types_1.OrderStatus.Broken:
            return DynamoOrderStatusOrdering.Broken;
        case types_1.OrderStatus.UnRefundable:
            return DynamoOrderStatusOrdering.UnRefundable;
        case types_1.OrderStatus.Duplicated:
            return DynamoOrderStatusOrdering.Duplicated;
        case types_1.OrderStatus.ToRepatriate:
            return DynamoOrderStatusOrdering.ToRepatriate;
        case types_1.OrderStatus.Repatriated:
            return DynamoOrderStatusOrdering.Repatriated;
        default:
            return DynamoOrderStatusOrdering.Broken;
    }
}
//# sourceMappingURL=types.js.map