import type { FasedAgentConfig } from "../config/types.fased.js";
import type { FederationManualOfferConfig, FederationMarketplaceAutomationPolicyConfig, FederationMarketplaceDeliveryRecordConfig, FederationMarketplaceDeliveryTargetConfig, FederationMarketplaceFulfillmentMode, FederationMarketplaceOrderConfig, FederationMarketplaceOrderStatus, FederationMarketplacePaymentIntentConfig, FederationMarketplacePriceUnit, FederationMarketplaceReceiptRuleConfig, FederationMarketplaceReceiptRecordConfig, FederationMarketplaceRequestConfig, FederationMarketplaceRequestStatus, FederationMarketplaceSellerSyncStatus, FederationMarketplaceSettlementRecordConfig, FederationMarketplaceSubscriptionConfig, FederationOfferAssetKind, FederationOfferPaymentDefaultsConfig, FederationOfferPricingConfig, FederationSkillOfferConfig } from "../config/types.federation.js";
export type FederationPublishedOffer = {
    schema: string;
    id: string;
    type: "AgentOffer";
    actor: string;
    title: string;
    summary?: string;
    serviceKind?: string;
    inputShape?: string;
    deliveryShape?: string;
    capabilities: string[];
    pricing: {
        currency: string;
        model: string;
        amount?: number;
        unit: FederationMarketplacePriceUnit;
        unitLabel?: string;
    };
    fulfillmentMode: FederationMarketplaceFulfillmentMode;
    performer: FederationMarketplaceFulfillmentMode;
    receiptRules: FederationMarketplaceReceiptRuleConfig[];
    automation?: FederationMarketplaceAutomationPolicyConfig;
    paymentRails?: string[];
    acceptedAssets?: string[];
    paymentDefaults?: {
        currency: string;
        chain: "solana";
        assetDecimals: number;
        asset: {
            kind: FederationOfferAssetKind;
            address?: string;
        };
        payee: {
            chain: "solana";
            address: string;
        };
    };
    availability?: string;
    visibility?: string;
    requiredTrustOrBondTier?: string;
    createdAt: string;
    updatedAt?: string;
};
export type FederationLocalOfferEntry = {
    source: "builtin" | "manual" | "skill";
    mutable: boolean;
    enabled: boolean;
    configId: string;
    offer: FederationPublishedOffer;
};
export type FederationManualOfferUpsertInput = {
    id?: string;
    enabled?: boolean;
    title: string;
    summary?: string;
    serviceKind: string;
    inputShape?: string;
    deliveryShape?: string;
    capabilities?: string[];
    pricing?: FederationOfferPricingConfig;
    fulfillmentMode?: FederationMarketplaceFulfillmentMode;
    performer?: FederationMarketplaceFulfillmentMode;
    receiptRules?: FederationMarketplaceReceiptRuleConfig[];
    automation?: FederationMarketplaceAutomationPolicyConfig;
    paymentRails?: string[];
    acceptedAssets?: string[];
    paymentDefaults?: FederationOfferPaymentDefaultsConfig;
    availability?: string;
    visibility?: string;
    requiredTrustOrBondTier?: string;
};
export type FederationMarketplacePublishedRequest = {
    schema: string;
    id: string;
    type: "MarketplaceRequest";
    source: "manual" | "chat";
    enabled: boolean;
    status: FederationMarketplaceRequestStatus;
    actor: string;
    title: string;
    summary?: string;
    serviceKind: string;
    inputShape?: string;
    deliveryShape?: string;
    capabilities: string[];
    pricing: {
        currency: string;
        model: string;
        amount?: number;
        unit: FederationMarketplacePriceUnit;
        unitLabel?: string;
    };
    fulfillmentMode: FederationMarketplaceFulfillmentMode;
    receiptRules: FederationMarketplaceReceiptRuleConfig[];
    paymentRails?: string[];
    acceptedAssets?: string[];
    requiredTrustOrBondTier?: string;
    visibility?: string;
    expiresAt?: string;
    createdAt: string;
    updatedAt?: string;
};
export type FederationMarketplaceLocalRequestEntry = {
    source: "manual" | "chat";
    mutable: boolean;
    enabled: boolean;
    status: FederationMarketplaceRequestStatus;
    configId: string;
    request: FederationMarketplacePublishedRequest;
};
export type FederationMarketplaceRequestUpsertInput = {
    id?: string;
    source?: "manual" | "chat";
    enabled?: boolean;
    status?: FederationMarketplaceRequestStatus;
    title: string;
    summary?: string;
    serviceKind: string;
    inputShape?: string;
    deliveryShape?: string;
    capabilities?: string[];
    pricing?: FederationOfferPricingConfig;
    fulfillmentMode?: FederationMarketplaceFulfillmentMode;
    receiptRules?: FederationMarketplaceReceiptRuleConfig[];
    paymentRails?: string[];
    acceptedAssets?: string[];
    requiredTrustOrBondTier?: string;
    visibility?: string;
    expiresAt?: string;
};
export type FederationMarketplaceOrderUpsertInput = {
    id?: string;
    source?: "local" | "federation";
    status?: FederationMarketplaceOrderStatus;
    offerId?: string;
    requestId?: string;
    buyerHandle?: string;
    sellerHandle?: string;
    sellerEndpoint?: string;
    sellerOrderId?: string;
    sellerSyncStatus?: FederationMarketplaceSellerSyncStatus;
    sellerSyncError?: string;
    sellerSyncedAt?: string;
    sellerAcceptedAt?: string;
    serviceKind?: string;
    title?: string;
    pricing?: FederationOfferPricingConfig;
    fulfillmentMode?: FederationMarketplaceFulfillmentMode;
    receiptRules?: FederationMarketplaceReceiptRuleConfig[];
    paymentIntent?: FederationMarketplacePaymentIntentConfig;
    settlement?: FederationMarketplaceSettlementRecordConfig;
    delivery?: FederationMarketplaceDeliveryRecordConfig;
    subscription?: FederationMarketplaceSubscriptionConfig;
    receipt?: FederationMarketplaceReceiptRecordConfig;
    invoiceId?: string;
    receiptId?: string;
    txRef?: string;
    resultRef?: string;
    disputeCaseId?: string;
};
export type FederationMarketplaceLocalOrderEntry = {
    source: "local" | "federation";
    status: NonNullable<FederationMarketplaceOrderConfig["status"]>;
    configId: string;
    order: FederationMarketplaceOrderConfig;
};
export declare function resolveOfferPaymentDefaults(env: NodeJS.ProcessEnv): FederationPublishedOffer["paymentDefaults"] | undefined;
export declare function listManualFederationOffers(config: FasedAgentConfig): FederationManualOfferConfig[];
export declare function listSkillFederationOffers(config: FasedAgentConfig): FederationSkillOfferConfig[];
export declare function validateMarketplaceDeliveryTargetConfig(input: FederationMarketplaceDeliveryTargetConfig | undefined): {
    ok: true;
} | {
    ok: false;
    reason: string;
};
export declare function listMarketplaceRequests(config: FasedAgentConfig): FederationMarketplaceRequestConfig[];
export declare function listLocalMarketplaceRequests(params: {
    origin: string;
    handle: string;
    config: FasedAgentConfig;
}): FederationMarketplaceLocalRequestEntry[];
export declare function buildPublishedFederationOffers(params: {
    origin: string;
    handle: string;
    config: FasedAgentConfig;
    env?: NodeJS.ProcessEnv;
}): FederationPublishedOffer[];
export declare function listLocalFederationOffers(params: {
    origin: string;
    handle: string;
    config: FasedAgentConfig;
    env?: NodeJS.ProcessEnv;
}): FederationLocalOfferEntry[];
export declare function upsertManualFederationOfferConfig(params: {
    config: FasedAgentConfig;
    input: FederationManualOfferUpsertInput;
    now?: string;
}): {
    config: FasedAgentConfig;
    offer: FederationManualOfferConfig;
    created: boolean;
};
export declare function upsertMarketplaceRequestConfig(params: {
    config: FasedAgentConfig;
    input: FederationMarketplaceRequestUpsertInput;
    now?: string;
}): {
    config: FasedAgentConfig;
    request: FederationMarketplaceRequestConfig;
    created: boolean;
};
export declare function deleteMarketplaceRequestConfig(params: {
    config: FasedAgentConfig;
    id: string;
}): {
    config: FasedAgentConfig;
    deleted: boolean;
};
export declare function listLocalMarketplaceDeliveryTargets(config: FasedAgentConfig): FederationMarketplaceDeliveryTargetConfig[];
export declare function upsertMarketplaceDeliveryTargetConfig(params: {
    config: FasedAgentConfig;
    input: FederationMarketplaceDeliveryTargetConfig;
    now?: string;
    fallback?: {
        orderId?: string;
        serviceKind?: string;
    };
}): {
    config: FasedAgentConfig;
    target: FederationMarketplaceDeliveryTargetConfig;
    created: boolean;
};
export declare function listLocalMarketplaceOrders(config: FasedAgentConfig): FederationMarketplaceLocalOrderEntry[];
export declare function upsertMarketplaceOrderConfig(params: {
    config: FasedAgentConfig;
    input: FederationMarketplaceOrderUpsertInput;
    now?: string;
}): {
    config: FasedAgentConfig;
    order: FederationMarketplaceOrderConfig;
    created: boolean;
};
export declare function deleteMarketplaceOrderConfig(params: {
    config: FasedAgentConfig;
    id: string;
}): {
    config: FasedAgentConfig;
    deleted: boolean;
};
export declare function deleteManualFederationOfferConfig(params: {
    config: FasedAgentConfig;
    id: string;
}): {
    config: FasedAgentConfig;
    deleted: boolean;
};
