/** * Data about an time period. */ export default class Period { /** The ID of the Period. */ id : string; /** The ID of the owning user. */ userId : string; /** The inclusive start time. */ from : Date; /** The exclusive end date. */ to : Date; /** The name of the time period, usually generated.*/ name : string; /** * Tags used to explain the goals being out of the ordinary. For example, * if leaving for a vacation where hobbies are best put on hold. */ tags : string[]; /** The goals set for this time period. */ goals : PeriodGoal[]; /** Logged activities during this time period. */ logs : PeriodLog[]; } /** * A goal set during the period. */ export class PeriodGoal { /** The ID of the PeriodGoal. */ id : string /** The activity ID associated with the goal. */ activityId : string /** The point count for the goal. 1000 is usually considered an hour's work. */ pointCount : number /** Optional sub-goals. */ subGoals : PeriodSubGoal[]; } /** * Optional sub-goals so that the user can award more points on important * activities and not use up all the points on time-sinking guilty pleasures. */ export class PeriodSubGoal { /** The ID of the PeriodSubGoal. */ id : string; /** A short name of the sub goal. */ name : string; /** The multiplier applied to the score. 1.10 = 10% better. */ multiplier : number; } /** * A logged activity during this time period. */ export class PeriodLog { /** The ID of the PeriodLog. */ id : string; /** The ID of the PeriodLog. */ date : Date; /** The ID of the sub-activity performed (see goal for activity id) */ subActivityId : string; /** The ID of the goal. */ goalId : string; /** The applicable sub goal, or `null` if none. */ subGoalId : string; /** A description of the activity performed. */ description : string; /** The amount of units done. */ amount : number /** The calculated score and its breakdown. */ score : PeriodLogScore } /** * The PeriodLogScore is a score for the log. This may not reflect the * latest numbers. */ export class PeriodLogScore { /** The amount of activity done (e.g number of words or minutes). */ amount : number; /** The score that's worth. */ activityScore : number; /** The subgoal multiplier in effect. */ subGoalMultiplier : number; /** The daily bonus, or 0 if not applicable. */ dailyBonus : number; /** The total score. */ total : number; } export interface PeriodUpdate { setFrom?: Date setTo?: Date setName?: string addLog?: PeriodLog removeLog?: string addGoal?: PeriodGoal replaceGoal?: PeriodGoal removeGoal?: string addTag?: string removeTag?: String }