import { environment } from 'src/environments/environment'; import { Choice } from './choice.model'; import { Comment } from './comment.model'; import { PollConfiguration } from './configuration.model'; import { Owner } from './owner.model'; import { DateChoice, TimeSlices } from '../../../../mocks/old-stuff/config/defaultConfigs'; export class ChoiceGroup { date_string: string; choices: Choice[]; } export class Poll { public id = 0; public default_expiracy_days_from_now = 60; public kind: string; public description?: string; public expiracy_date?: string; public creation_date?: string; public creatorPseudo?: string; public creatorEmail?: string; public is_archived?: boolean; public is_zero_knowledge?: boolean = false; public allow_comments?: boolean = true; public has_several_hours?: boolean = false; public allowSeveralHours?: boolean; public archiveNumberOfDays?: number; public max_score?: number; public max_count_of_answers?: number = 150; public configuration: PollConfiguration = new PollConfiguration(); public comments: Comment[] = []; public choices: Choice[] = []; public choicesDateGrouped: ChoiceGroup[] = []; public votes = []; public stacks = []; public allowed_answers = []; public modification_policy = 'everybody'; public dateChoices: DateChoice[] = []; // sets of days as strings, config to set identical time for days in a special days poll public timeSlices: TimeSlices[] = []; // ranges of time expressed as strings constructor(public owner: Owner = new Owner(), public title = 'mon titre', public custom_url: string = '') {} public getAdministrationUrl(): string { return `${environment.api.baseHref}/administration/polls/${this.custom_url}`; } public getParticipationUrl(): string { return `${environment.api.baseHref}/participation/polls/${this.custom_url}`; } }