// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

library AtomicTypes {
    enum ObligationStatus {
        None,
        IntentCreated,
        Fulfilled,
        SettlementPending,
        Settled,
        Refunded,
        Slashed
    }

    enum RouteClass {
        Blocked,
        Planning,
        ExecutionReady
    }

    struct AtomicIntent {
        uint64 sourceChain;
        uint64 destinationChain;
        address assetIn;
        address assetOut;
        uint256 amountIn;
        uint256 minAmountOut;
        address recipient;
        uint256 deadline;
        bytes32 routeId;
        bytes32 intentId;
    }

    struct AtomicCommitment {
        bytes32 intentId;
        address fulfiller;
        uint256 reservedLiquidity;
        uint256 bondAmount;
        uint256 expiry;
        bytes32 settlementMode;
    }

    struct AtomicObligation {
        bytes32 obligationId;
        bytes32 intentId;
        uint256 sourceEscrow;
        uint256 destinationReserve;
        address fulfiller;
        ObligationStatus status;
        uint256 settlementInitiatedAt;
    }

    struct CorridorLiquidityState {
        uint256 totalLiquidity;
        uint256 reservedLiquidity;
        uint256 freeLiquidity;
        uint256 targetBuffer;
        uint256 settlementBacklog;
    }

    struct CorridorConfig {
        bool enabled;
        bool degraded;
        uint64 sourceChain;
        uint64 destinationChain;
        address assetIn;
        address assetOut;
        uint256 maxNotional;
        uint16 maxReservedBps;
        uint256 targetBuffer;
        uint256 maxSettlementBacklog;
        uint16 maxOracleDriftBps;
        uint256 fulfilmentTimeout;
        uint256 settlementTimeout;
        bytes32 defaultSettlementMode;
    }

    struct AtomicQuote {
        RouteClass routeClass;
        uint256 availableLiquidity;
        uint256 freeLiquidity;
        uint256 fulfillerFee;
        uint256 protocolFee;
        uint256 requiredBond;
        uint256 settlementBacklog;
        uint256 deadlineWindow;
        bool corridorEnabled;
        bool corridorDegraded;
        bool fulfillerAuthorized;
        bool fulfillerBondSufficient;
    }
}
