import JsonManager from "./utils/jsonManager.js";

export class UsersToken {
    constructor(filePath) {
        this.filePath = filePath;
        this.data = JsonManager.read(this.filePath);
    }

    reload() {
        this.data = JsonManager.read(this.filePath);
    }

    upsert(data) {
        JsonManager.upsertToken(this.filePath, data);
        this.reload();
    }

    get(index){
        return this.data[index];
    }

    getAll(){
        return this.data;
    }

}