package org.ghidra.bridge.session;

public final class BridgeSession {
    private final HandleRegistry<ProjectHandle> projects = new HandleRegistry<>(ProjectHandle.class);
    private final HandleRegistry<ProgramHandle> programs = new HandleRegistry<>(ProgramHandle.class);
    private final HandleRegistry<DecompilerHandle> decompilers = new HandleRegistry<>(DecompilerHandle.class);
    private final HandleRegistry<TransactionHandle> transactions = new HandleRegistry<>(TransactionHandle.class);

    public long insertProject(ProjectHandle project) {
        return projects.insert(project);
    }

    public ProjectHandle project(long handle) {
        return projects.get(handle);
    }

    public ProjectHandle removeProject(long handle) {
        return projects.remove(handle);
    }

    public long insertProgram(ProgramHandle program) {
        return programs.insert(program);
    }

    public ProgramHandle program(long handle) {
        return programs.get(handle);
    }

    public ProgramHandle removeProgram(long handle) {
        return programs.remove(handle);
    }

    public long insertDecompiler(DecompilerHandle decompiler) {
        return decompilers.insert(decompiler);
    }

    public DecompilerHandle decompiler(long handle) {
        return decompilers.get(handle);
    }

    public DecompilerHandle removeDecompiler(long handle) {
        return decompilers.remove(handle);
    }

    public long insertTransaction(TransactionHandle transaction) {
        return transactions.insert(transaction);
    }

    public TransactionHandle transaction(long handle) {
        return transactions.get(handle);
    }

    public TransactionHandle removeTransaction(long handle) {
        return transactions.remove(handle);
    }
}
