123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- // _____ _
- // |_ _| |_ _ _ ___ ___ _ __ __ _
- // | | | ' \| '_/ -_) -_) ' \/ _` |_
- // |_| |_||_|_| \___\___|_|_|_\__,_(_)
- //
- // Threema iOS Client
- // Copyright (c) 2014-2020 Threema GmbH
- //
- // This program is free software: you can redistribute it and/or modify
- // it under the terms of the GNU Affero General Public License, version 3,
- // as published by the Free Software Foundation.
- //
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU Affero General Public License for more details.
- //
- // You should have received a copy of the GNU Affero General Public License
- // along with this program. If not, see <https://www.gnu.org/licenses/>.
- #import <Foundation/Foundation.h>
- #import <CoreData/CoreData.h>
- @class Contact,BallotChoice, BallotMessage, Conversation;
- @interface Ballot : NSManagedObject
- @property (nonatomic, retain) NSNumber * assessmentType;
- @property (nonatomic, retain) NSNumber * choicesType;
- @property (nonatomic, retain) NSDate * createDate;
- @property (nonatomic, retain) NSString * creatorId;
- @property (nonatomic, retain) NSString * title;
- @property (nonatomic, retain) NSData * id;
- @property (nonatomic, retain) NSDate * modifyDate;
- @property (nonatomic, retain) NSNumber * state;
- @property (nonatomic, retain) NSNumber * type;
- @property (nonatomic, retain) NSNumber * unreadUpdateCount;
- @property (nonatomic, retain) NSSet *choices;
- @property (nonatomic, retain) Conversation *conversation;
- @property (nonatomic, retain) NSSet *message;
- // participants are persisted when the ballot is closed
- @property (nonatomic, retain) NSSet *participants;
- @end
- @interface Ballot (CoreDataGeneratedAccessors)
- - (void)addChoicesObject:(BallotChoice *)value;
- - (void)removeChoicesObject:(BallotChoice *)value;
- - (void)addChoices:(NSSet *)values;
- - (void)removeChoices:(NSSet *)values;
- - (void)addMessageObject:(BallotMessage *)value;
- - (void)removeMessageObject:(BallotMessage *)value;
- - (void)addMessage:(NSSet *)values;
- - (void)removeMessage:(NSSet *)values;
- - (void)addParticipantsObject:(Contact *)value;
- - (void)removeParticipantsObject:(Contact *)value;
- - (void)addParticipants:(NSSet *)values;
- - (void)removeParticipants:(NSSet *)values;
- #pragma mark - own definitions & methods
- enum {
- kBallotStateOpen = 0,
- kBallotStateClosed
- };
- enum {
- kBallotTypeClosed = 0,
- kBallotTypeIntermediate
- };
- enum {
- kBallotAssessmentTypeSingle = 0,
- kBallotAssessmentTypeMultiple
- };
- - (NSArray *)choicesSortedByOrder;
- - (void)setClosed;
- - (void)setMultipleChoice:(BOOL)multipleChoice;
- - (void)setIntermediate:(BOOL)intermediate;
- - (BOOL)isClosed;
- - (BOOL)isMultipleChoice;
- - (BOOL)isIntermediate;
- - (BOOL)displayResult;
- - (BOOL)isOwn;
- - (BOOL)canEdit;
- - (void)incrementUnreadUpdateCount;
- - (void)resetUnreadUpdateCount;
- - (NSInteger)numberOfReceivedVotes;
- - (NSInteger)participantCount;
- @end
|