2018-07-12 14:11:31 +02:00
|
|
|
import { Deserializable } from '../deserializable.model';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Representation of a poll option
|
|
|
|
*
|
|
|
|
* part of the 'polls-options'-array in poll
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
export class PollOption implements Deserializable {
|
2018-08-29 13:21:25 +02:00
|
|
|
public id: number;
|
|
|
|
public candidate_id: number;
|
|
|
|
public is_elected: boolean;
|
|
|
|
public votes: number[];
|
|
|
|
public poll_id: number;
|
|
|
|
public weight: number;
|
2018-07-12 14:11:31 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Needs to be completely optional because poll has (yet) the optional parameter 'poll-options'
|
|
|
|
* @param id
|
|
|
|
* @param candidate_id
|
|
|
|
* @param is_elected
|
|
|
|
* @param votes
|
|
|
|
* @param poll_id
|
|
|
|
* @param weight
|
|
|
|
*/
|
2018-08-29 13:21:25 +02:00
|
|
|
public constructor(
|
2018-07-12 14:11:31 +02:00
|
|
|
id?: number,
|
|
|
|
candidate_id?: number,
|
|
|
|
is_elected?: boolean,
|
|
|
|
votes?: number[],
|
|
|
|
poll_id?: number,
|
|
|
|
weight?: number
|
|
|
|
) {
|
|
|
|
this.id = id;
|
|
|
|
this.candidate_id = candidate_id;
|
|
|
|
this.is_elected = is_elected;
|
|
|
|
this.votes = votes;
|
|
|
|
this.poll_id = poll_id;
|
|
|
|
this.weight = weight;
|
|
|
|
}
|
|
|
|
|
2018-08-29 13:21:25 +02:00
|
|
|
public deserialize(input: any): this {
|
2018-07-12 14:11:31 +02:00
|
|
|
Object.assign(this, input);
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|