/**
 * g1nation Custom Error Classes
 */

abstract class G1Error extends Error {
    constructor(public message: string, public details?: any) {
        super(message);
        this.name = this.constructor.name;
    }

    abstract getTypeCode(): string;
}

export class AgentExecutionError extends G1Error {
    getTypeCode() { return 'AGENT_EXECUTION_ERROR'; }
}

export class FileSystemError extends G1Error {
    constructor(message: string, public path: string, details?: any) {
        super(message, details);
    }
    getTypeCode() { return 'FILE_SYSTEM_ERROR'; }
}

export class APICommunicationError extends G1Error {
    constructor(message: string, public engine: string, public status?: number, details?: any) {
        super(message, details);
    }
    getTypeCode() { return 'API_COMMUNICATION_ERROR'; }
}

export class TransactionError extends G1Error {
    getTypeCode() { return 'TRANSACTION_ERROR'; }
}
