#ifndef INCLUDED_BOBCAT_USER
#define INCLUDED_BOBCAT_USER

#include <string>

struct passwd;

namespace FBB
{
class User
{
    std::string d_name;
    std::string d_password;
    std::string d_realname;
    std::string d_homedir;
    std::string d_shell;
    size_t d_uid;
    size_t d_gid;

    public:
        User();                         // 1.cc
        User(std::string const &name);  // 2.cc details of user 'name'
        User(size_t uid);               // 3.cc details of user whose ID is 
                                        //      uid

        User(User const &other) = default;
        User(User &&tmp);               // 4.cc

        User &operator=(User const &rhs) = default;
        User &operator=(User &&tmp);

        void verify() const;        // kept for bacward compatibility

        size_t eGroupid() const;
        size_t eUserid() const;
        size_t groupid() const;                                     // .f
        bool inGroup(size_t gid, bool useEffective = true) const;
        size_t userid() const;                                      // .f
        bool inGroup(size_t gid) const;
        std::string const &homedir() const;                         // .f
        std::string const &name() const;                            // .f
        std::string const &password() const;                        // .f
        std::string const &realname() const;                        // .f
        std::string const &shell() const;                           // .f

    private:
        void assign(passwd const *pwd); // assign pwd fields to this object
        static void failure();          // throws Exception
};

#include "groupid.f"
#include "homedir.f"
#include "name.f"
#include "password.f"
#include "realname.f"
#include "shell.f"
#include "userid.f"

} // FBB

#endif
