/
NYPLHoldsNotificationState.m
42 lines (37 loc) · 1.77 KB
/
NYPLHoldsNotificationState.m
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
//
// NYPLHoldsNotificationState.m
// SimplyE
//
// Created by Vui Nguyen on 11/16/18.
// Copyright © 2018 NYPL Labs. All rights reserved.
//
#import "NYPLHoldsNotificationState.h"
static NSString *const NotApplicable = @"not-applicable";
static NSString *const ReadyForFirstNotification = @"ready-for-first-notification";
static NSString *const FirstNotificationSent = @"first-notification-sent";
static NSString *const ReadyForFinalNotification = @"ready-for-final-notification";
static NSString *const FinalNotificationSent = @"final-notification-sent";
NYPLHoldsNotificationState NYPLHoldsNotificationStateFromString(NSString *string)
{
if([string isEqualToString:NotApplicable]) return NYPLHoldsNotificationStateNotApplicable;
if([string isEqualToString:ReadyForFirstNotification]) return NYPLHoldsNotificationStateReadyForFirstNotification;
if([string isEqualToString:FirstNotificationSent]) return NYPLHoldsNotificationStateFirstNotificationSent;
if([string isEqualToString:ReadyForFinalNotification]) return NYPLHoldsNotificationStateReadyForFinalNotification;
if([string isEqualToString:FinalNotificationSent]) return NYPLHoldsNotificationStateFinalNotificationSent;
@throw NSInvalidArgumentException;
}
NSString *NYPLHoldsNotificationStateToString(NYPLHoldsNotificationState state)
{
switch(state) {
case NYPLHoldsNotificationStateNotApplicable:
return NotApplicable;
case NYPLHoldsNotificationStateReadyForFirstNotification:
return ReadyForFirstNotification;
case NYPLHoldsNotificationStateFirstNotificationSent:
return FirstNotificationSent;
case NYPLHoldsNotificationStateReadyForFinalNotification:
return ReadyForFinalNotification;
case NYPLHoldsNotificationStateFinalNotificationSent:
return FinalNotificationSent;
}
}