1/*
2 * Copyright 2019, Andrew Lindesay <apl@lindesay.co.nz>.
3 *
4 * All rights reserved. Distributed under the terms of the MIT License.
5 */
6#ifndef USER_DETAIL_H
7#define USER_DETAIL_H
8
9#include <stdio.h>
10
11#include <Archivable.h>
12#include <String.h>
13
14#include "DateTime.h"
15
16
17class UserUsageConditionsAgreement : public BArchivable {
18public:
19								UserUsageConditionsAgreement(BMessage* from);
20								UserUsageConditionsAgreement();
21	virtual						~UserUsageConditionsAgreement();
22
23	const	BString&			Code() const;
24	const	uint64				TimestampAgreed() const;
25	const	bool				IsLatest() const;
26
27			void				SetCode(const BString& value);
28			void				SetTimestampAgreed(uint64 value);
29			void				SetIsLatest(const bool value);
30
31			UserUsageConditionsAgreement&
32								operator=(
33									const UserUsageConditionsAgreement& other);
34
35			status_t			Archive(BMessage* into, bool deep = true) const;
36private:
37			BString				fCode;
38			uint64				fTimestampAgreed;
39				// milliseconds since epoc
40			bool				fIsLatest;
41};
42
43
44/*! This objects represents a user in the HaikuDepotServer system.
45 */
46
47class UserDetail : public BArchivable {
48public:
49								UserDetail(BMessage* from);
50								UserDetail();
51	virtual						~UserDetail();
52
53	const	BString&			Nickname() const;
54	const	UserUsageConditionsAgreement&
55								Agreement() const;
56
57			void				SetNickname(const BString& value);
58			void				SetAgreement(
59									const UserUsageConditionsAgreement& value);
60
61			UserDetail&			operator=(const UserDetail& other);
62
63			status_t			Archive(BMessage* into, bool deep = true) const;
64private:
65			BString				fNickname;
66			UserUsageConditionsAgreement
67								fAgreement;
68};
69
70
71#endif // USER_DETAIL_H
72