#pragma once
#include "fs/VFS.h"
#include <luna/SharedPtr.h>
#include <luna/String.h>

struct OpenFileDescription : public Shareable
{
    SharedPtr<VFS::Inode> inode;
    int flags { 0 };
    String path;

    OpenFileDescription(SharedPtr<VFS::Inode>, int);
    ~OpenFileDescription();
};

struct FileDescriptor
{
    SharedPtr<OpenFileDescription> description;
    usize offset { 0 };
    int flags { 0 };

    bool should_append();
    bool should_block();
    bool is_writable();
    bool is_readable();

    SharedPtr<VFS::Inode> inode()
    {
        return description->inode;
    }

    int& status_flags()
    {
        return description->flags;
    }
};