import { Schema } from "effect" export class InvalidRequestError extends Schema.TaggedErrorClass()( "InvalidRequestError", { message: Schema.String, kind: Schema.optional(Schema.String), field: Schema.optional(Schema.String), }, { httpApiStatus: 400 }, ) {} export class UnauthorizedError extends Schema.TaggedErrorClass()( "UnauthorizedError", { message: Schema.String }, { httpApiStatus: 401 }, ) {} export class ForbiddenError extends Schema.TaggedErrorClass()( "ForbiddenError", { message: Schema.String }, { httpApiStatus: 403 }, ) {} export class ConflictError extends Schema.TaggedErrorClass()( "ConflictError", { message: Schema.String, resource: Schema.optional(Schema.String), }, { httpApiStatus: 409 }, ) {} export class UpstreamError extends Schema.TaggedErrorClass()( "UpstreamError", { message: Schema.String, service: Schema.optional(Schema.String), status: Schema.optional(Schema.Number), }, { httpApiStatus: 502 }, ) {} export class ServiceUnavailableError extends Schema.TaggedErrorClass()( "ServiceUnavailableError", { message: Schema.String, service: Schema.optional(Schema.String), }, { httpApiStatus: 503 }, ) {} export class TimeoutError extends Schema.TaggedErrorClass()( "TimeoutError", { message: Schema.String, operation: Schema.optional(Schema.String), }, { httpApiStatus: 504 }, ) {} export class UnknownError extends Schema.TaggedErrorClass()( "UnknownError", { message: Schema.String, ref: Schema.optional(Schema.String), }, { httpApiStatus: 500 }, ) {} export class ProviderNotFoundError extends Schema.TaggedErrorClass()( "ProviderNotFoundError", { providerID: Schema.String, message: Schema.String, }, { httpApiStatus: 404 }, ) {} export class ModelNotFoundError extends Schema.TaggedErrorClass()( "ModelNotFoundError", { providerID: Schema.String, modelID: Schema.String, suggestions: Schema.Array(Schema.String), message: Schema.String, }, { httpApiStatus: 404 }, ) {} export class SessionNotFoundError extends Schema.TaggedErrorClass()( "SessionNotFoundError", { sessionID: Schema.String, message: Schema.String, }, { httpApiStatus: 404 }, ) {} export class MessageNotFoundError extends Schema.TaggedErrorClass()( "MessageNotFoundError", { sessionID: Schema.String, messageID: Schema.String, message: Schema.String, }, { httpApiStatus: 404 }, ) {} export class InvalidCursorError extends Schema.TaggedErrorClass()( "InvalidCursorError", { message: Schema.String }, { httpApiStatus: 400 }, ) {} export class SessionBusyError extends Schema.TaggedErrorClass()( "SessionBusyError", { sessionID: Schema.String, message: Schema.String, }, { httpApiStatus: 409 }, ) {} export class QuestionNotFoundError extends Schema.TaggedErrorClass()( "QuestionNotFoundError", { requestID: Schema.String, message: Schema.String, }, { httpApiStatus: 404 }, ) {} export class PermissionNotFoundError extends Schema.TaggedErrorClass()( "PermissionNotFoundError", { requestID: Schema.String, message: Schema.String, }, { httpApiStatus: 404 }, ) {} export class McpServerNotFoundError extends Schema.TaggedErrorClass()( "McpServerNotFoundError", { name: Schema.String, message: Schema.String, }, { httpApiStatus: 404 }, ) {} export class PtyNotFoundError extends Schema.TaggedErrorClass()( "PtyNotFoundError", { ptyID: Schema.String, message: Schema.String, }, { httpApiStatus: 404 }, ) {} export class PtyForbiddenError extends Schema.TaggedErrorClass()( "PtyForbiddenError", { message: Schema.String, }, { httpApiStatus: 403 }, ) {} export class ProjectNotFoundError extends Schema.TaggedErrorClass()( "ProjectNotFoundError", { projectID: Schema.String, message: Schema.String, }, { httpApiStatus: 404 }, ) {} export class ApiNotFoundError extends Schema.ErrorClass("NotFoundError")( { name: Schema.Literal("NotFoundError"), data: Schema.Struct({ message: Schema.String, }), }, { httpApiStatus: 404 }, ) {} export function notFound(message: string) { return new ApiNotFoundError({ name: "NotFoundError", data: { message }, }) }