001// --------------------------------------------------------------------------------
002// Copyright 2002-2025 Echo Three, LLC
003//
004// Licensed under the Apache License, Version 2.0 (the "License");
005// you may not use this file except in compliance with the License.
006// You may obtain a copy of the License at
007//
008//     http://www.apache.org/licenses/LICENSE-2.0
009//
010// Unless required by applicable law or agreed to in writing, software
011// distributed under the License is distributed on an "AS IS" BASIS,
012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013// See the License for the specific language governing permissions and
014// limitations under the License.
015// --------------------------------------------------------------------------------
016
017package com.echothree.model.control.party.server.graphql;
018
019import com.echothree.model.data.party.server.entity.Person;
020import graphql.annotations.annotationTypes.GraphQLDescription;
021import graphql.annotations.annotationTypes.GraphQLField;
022import graphql.annotations.annotationTypes.GraphQLName;
023
024@GraphQLDescription("person object")
025@GraphQLName("Person")
026public class PersonObject {
027    
028    private final Person person; // Always Present
029    
030    public PersonObject(Person person) {
031        this.person = person;
032    }
033
034    @GraphQLField
035    @GraphQLDescription("personal title")
036    public PersonalTitleObject getPersonalTitle() {
037        var personalTitle = person.getPersonalTitle();
038        
039        return personalTitle == null ? null : new PersonalTitleObject(personalTitle);
040    }
041    
042    @GraphQLField
043    @GraphQLDescription("first name")
044    public String getFirstName() {
045        return person.getFirstName();
046    }
047    
048    @GraphQLField
049    @GraphQLDescription("middle name")
050    public String getMiddleName() {
051        return person.getMiddleName();
052    }
053    
054    @GraphQLField
055    @GraphQLDescription("last name")
056    public String getLastName() {
057        return person.getLastName();
058    }
059    
060    @GraphQLField
061    @GraphQLDescription("name suffix")
062    public NameSuffixObject getNameSuffix() {
063        var nameSuffix = person.getNameSuffix();
064        
065        return nameSuffix == null ? null : new NameSuffixObject(nameSuffix);
066    }
067    
068}