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.person;
7 
8 import diamond.core.apptype;
9 
10 static if (isWeb)
11 {
12   import diamond.seo.schema.schemaobject;
13   import diamond.seo.schema.structures.postaladdress;
14 
15   /// http://schema.org/Person
16   final class Person : SchemaObject
17   {
18     private:
19     /// The name.
20     string _name;
21     /// The image.
22     string _image;
23     /// The same as.
24     string _sameAs;
25     /// The disambiguating description.
26     string _disambiguatingDescription;
27     /// The children.
28     Person _children;
29     /// The address.
30     PostalAddress _address;
31     /// The colleague.
32     Person _colleague;
33     /// The colleagues.
34     Person[] _colleagues;
35     /// The email.
36     string _email;
37     /// The job title.
38     string _jobTitle;
39     /// The url.
40     string _url;
41     /// The id.
42     string _id;
43 
44     public:
45     final:
46     /// Creates a new person.
47     this()
48     {
49       super("Person");
50     }
51 
52     @property
53     {
54       /// Gets the name.
55       string name() { return _name; }
56 
57       /// Sets the name.
58       void name(string newName)
59       {
60         _name = newName;
61 
62         super.addField("name", _name);
63       }
64 
65       /// Gets the image.
66       string image() { return _image; }
67 
68       /// Sets the image.
69       void image(string newImage)
70       {
71         _image = newImage;
72 
73         super.addField("image", _image);
74       }
75 
76       /// Gets the same as.
77       string sameAs() { return _sameAs; }
78 
79       /// Sets the same as.
80       void sameAs(string newSameAs)
81       {
82         _sameAs = newSameAs;
83 
84         super.addField("sameAs", _sameAs);
85       }
86 
87       /// Gets the disambiguating description.
88       string disambiguatingDescription() { return _disambiguatingDescription; }
89 
90       /// Sets the disambiguating description.
91       void disambiguatingDescription(string newDisambiguatingDescription)
92       {
93         _disambiguatingDescription = newDisambiguatingDescription;
94 
95         super.addField("disambiguatingDescription", _disambiguatingDescription);
96       }
97 
98       /// Gets the children.
99       Person children() { return _children; }
100 
101       /// Sets the children.
102       void children(Person newChildren)
103       {
104         _children = newChildren;
105 
106         super.addField("children", _children);
107       }
108 
109       /// Gets the address.
110       PostalAddress address() { return _address; }
111 
112       /// Sets the address.
113       void address(PostalAddress newPostalAddress)
114       {
115         _address = newPostalAddress;
116 
117         super.addField("address", _address);
118       }
119 
120       /// Gets the colleague. Supersedes colleagues.
121       Person colleague() { return _colleague; }
122 
123       /// Sets the colleague. Supersedes colleagues.
124       void colleague(Person newColleague)
125       {
126         _colleague = newColleague;
127 
128         super.addField("colleague", _colleague);
129 
130         _colleagues = null;
131         super.removeField("colleagues");
132       }
133 
134       /// Get the colleagues. Superseded by colleague.
135       Person[] colleagues() { return _colleagues; }
136 
137       /// Sets the colleagues. Superseded by colleague.
138       void colleagues(Person[] newColleagues)
139       {
140         if (_colleague)
141         {
142           return;
143         }
144 
145         _colleagues = newColleagues;
146 
147         super.addField("colleagues", _colleagues);
148       }
149 
150       /// Gets the email.
151       string email() { return _email; }
152 
153       /// Sets the email.
154       void email(string newEmail)
155       {
156         _email = newEmail;
157 
158         super.addField("email", _email);
159       }
160 
161       /// Gets the job title.
162       string jobTitle() { return _jobTitle; }
163 
164       /// Sets the job title.
165       void jobTitle(string newJobTitle)
166       {
167         _jobTitle = newJobTitle;
168       }
169 
170       /// Gets the url.
171       string url() { return _url; }
172 
173       /// Sets the url.
174       void url(string newUrl)
175       {
176         _url = newUrl;
177       }
178 
179       /// Gets the id. The field name is "@id"
180       string id() { return _id; }
181 
182       /// Sets the id. The field name is "@id"
183       void id(string newId)
184       {
185         _id = newId;
186 
187         super.addField("@id", _id);
188       }
189     }
190   }
191 }