1 /**
2 * Copyright © DiamondMVC 2019
3 * License: MIT (https://github.com/DiamondMVC/Diamond/blob/master/LICENSE)
4 * Author: Jacob Jensen (bausshf)
5 */
6 module diamond.seo.schema.structures.event;
7 
8 import diamond.core.apptype;
9 
10 static if (isWeb)
11 {
12   import diamond.seo.schema.schemaobject;
13   import diamond.seo.schema.structures.place;
14   import diamond.seo.schema.structures.offer;
15   import diamond.seo.schema.structures.organizations.performinggroup;
16 
17   /// http://schema.org/EventStatus
18   enum EventStatus : string
19   {
20     /// Event cancelled.
21     eventCancelled = "http://schema.org/EventCancelled",
22 
23     /// Event postponed.
24     eventPostponed = "http://schema.org/EventPostponed",
25 
26     /// Event rescheduled.
27     eventRescheduled = "http://schema.org/EventRescheduled",
28 
29     /// Event scheduled.
30     eventScheduled = "http://schema.org/EventScheduled"
31   }
32 
33   /// http://schema.org/Event
34   class Event : SchemaObject
35   {
36     private:
37     /// The location.
38     Place _location;
39     /// The name.
40     string _name;
41     /// The start date.
42     string _startDate;
43     /// The event status.
44     EventStatus _eventStatus;
45     /// The offers.
46     Offer _offers;
47     /// The performer.
48     PerformingGroup[] _performer;
49     /// The typical age range.
50     string _typicalAgeRange;
51 
52     public:
53     /// Creates a new event.
54     this()
55     {
56       super("Event");
57     }
58 
59     /**
60     * Creates a new event.
61     * Params:
62     *   eventType = The type of the event.
63     */
64     protected this(string eventType)
65     {
66       super(eventType);
67     }
68 
69     @property
70     {
71       final
72       {
73         /// Gets the location.
74         Place location() { return _location; }
75 
76         /// Sets the location.
77         void location(Place newLocation)
78         {
79           _location = newLocation;
80 
81           super.addField("location", _location);
82         }
83 
84         /// Gets the name.
85         string name() { return _name; }
86 
87         /// Sets the name.
88         void name(string newName)
89         {
90           _name = newName;
91 
92           super.addField("name", _name);
93         }
94 
95         /// Gets the start date.
96         string startDate() { return _startDate; }
97 
98         /// Sets the start date.
99         void startDate(string newStartDate)
100         {
101           _startDate = newStartDate;
102 
103           super.addField("startDate", _startDate);
104         }
105 
106         /// Gets the event status.
107         EventStatus eventStatus() { return _eventStatus; }
108 
109         /// Sets the event status.
110         void eventStatus(EventStatus newEventStatus)
111         {
112           _eventStatus = newEventStatus;
113 
114           super.addField("eventStatus", cast(string)_eventStatus);
115         }
116 
117         /// Gets the offers.
118         Offer offers() { return _offers; }
119 
120         /// Sets the offers.
121         void offers(Offer newOffers)
122         {
123           _offers = newOffers;
124 
125           super.addField("offers", _offers);
126         }
127 
128         /// Gets the performer.
129         PerformingGroup[] performer() { return _performer; }
130 
131         /// Sets the performer.
132         void performer(PerformingGroup[] newPerformer)
133         {
134           _performer = newPerformer;
135 
136           super.addField("performer", _performer);
137         }
138 
139         /// Gets the typical age range.
140         string typicalAgeRange() { return _typicalAgeRange; }
141 
142         /// Sets the typical age range.
143         void typicalAgeRange(string newTypicalAgeRange)
144         {
145           _typicalAgeRange = newTypicalAgeRange;
146 
147           super.addField("typicalAgeRange", _typicalAgeRange);
148         }
149       }
150     }
151   }
152 }