/**
 * Chat V2 — Internal types and wire-format DTOs.
 *
 * The shapes here back the Chat MVP Phase 1 spec
 * (`.crewly/specs/chat-mvp-phase1-tech-spec-2026-04-24.md` §21).
 * They are deliberately isolated from the existing `types/chat.types.ts`,
 * which belongs to the legacy orchestrator chat pipe.
 *
 * @module services/chat-v2/types
 */
/** Enum values exposed as readonly tuples for runtime validation. */
export const CHAT_SENDER_TYPES = ['user', 'agent', 'system'];
export const CHAT_CONTENT_TYPES = [
    'text',
    'markdown',
    'image_ref',
    'system_note',
];
/** Phase B — channel-type tuple for runtime validation in CreateChannelInput. */
export const CHAT_CHANNEL_TYPES = ['dm', 'channel', 'huddle'];
/** Phase B — mention-kind tuple for runtime validation in mention parsing. */
export const CHAT_MENTION_KINDS = ['team', 'agent'];
// ---------------------------------------------------------------------------
// Error codes — stable strings; `@crewly/chat-ui` switches UI state on them
// ---------------------------------------------------------------------------
/** Canonical error-code strings. */
export const CHAT_ERROR_CODES = {
    VALIDATION: 'validation_error',
    NOT_FOUND: 'not_found',
    CHANNEL_NOT_FOUND: 'channel_not_found',
    AGENT_NOT_FOUND: 'agent_not_found',
    FORBIDDEN: 'forbidden',
    /**
     * F2b (#333) — caller is authenticated but is not a member of the
     * `teamId` they tried to bind a `type='channel'` channel to. Distinct
     * from FORBIDDEN so the FE can surface a tenant-specific message
     * instead of a generic 403.
     */
    FORBIDDEN_TEAM: 'forbidden_team',
    AGENT_ALREADY_BOUND: 'agent_already_bound',
    PAYLOAD_TOO_LARGE: 'payload_too_large',
    RATE_LIMITED: 'rate_limited',
    INVALID_CURSOR: 'invalid_cursor',
    CHANNEL_ARCHIVED: 'channel_archived',
    ATTACHMENT_NOT_FOUND: 'attachment_not_found',
    INTERNAL: 'internal_error',
};
/** Structured error thrown by stores/service; controller maps to HTTP. */
export class ChatError extends Error {
    code;
    httpStatus;
    details;
    constructor(code, httpStatus, message, details) {
        super(message);
        this.code = code;
        this.httpStatus = httpStatus;
        this.details = details;
        this.name = 'ChatError';
    }
}
//# sourceMappingURL=types.js.map