forked from C3-PRO/c3-pro-ios-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
User.swift
85 lines (46 loc) · 1.42 KB
/
User.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//
// User.swift
// C-Tracker-SCCS
//
// Created by Pascal Pfiffner on 11/28/16.
// Copyright © 2016 SCCS. All rights reserved.
//
import Foundation
import HealthKit
public protocol User {
var userId: String? { get set }
var name: String? { get set }
var birthDate: Date? { get set }
var biologicalSex: HKBiologicalSex { get set }
var bloodType: HKBloodType { get set }
var ethnicity: String? { get set }
var bodyheight: HKQuantity? { get set }
var bodyweight: HKQuantity? { get set }
var profileImage: Data? { get }
/// Whether this user represents a test/sample user; use it to determine whether data should be sent to your server or not.
var isSampleUser: Bool { get set }
init()
// MARK: - Enrollment
var enrollmentDate: Date? { get set }
func didEnroll(on date: Date)
var linkedDate: Date? { get set }
var linkedAgainst: URL? { get set }
func didLink(on date: Date, against url: URL)
// MARK: - Tasks
var tasks: [UserTask] { get set }
var tasksOutstanding: [UserTask] { get }
var tasksPast: [UserTask] { get }
func add(task: UserTask) throws
// MARK: - Human Readable
var humanSummary: String { get }
var humanBirthday: String? { get }
var humanSex: String { get }
var humanHeight: String? { get }
var humanWeight: String? { get }
}
// MARK: -
extension User {
static func ==(a: User, b: User) -> Bool {
return a.userId == b.userId
}
}