1919from pydantic import Field
2020
2121from .location import Location
22+ from .relationship import Relationship
2223from .static_structure_element import StaticStructureElement , StaticStructureElementIO
24+ from .tags import Tags
2325
2426
2527__all__ = ("PersonIO" , "Person" )
@@ -35,7 +37,7 @@ class PersonIO(StaticStructureElementIO):
3537 """
3638
3739 location : Location = Field (
38- Location .Unspecified , description = "The location of this person."
40+ default = Location .Unspecified , description = "The location of this person."
3941 )
4042
4143
@@ -48,20 +50,22 @@ class Person(StaticStructureElement):
4850
4951 """
5052
51- location : Location = Field (
52- Location .Unspecified , description = "The location of this person."
53- )
54-
5553 def __init__ (self , * , location : Location = Location .Unspecified , ** kwargs ) -> None :
5654 """"""
5755 super ().__init__ (** kwargs )
5856 self .location = location
5957
58+ self .tags .add (Tags .PERSON )
59+
6060 @classmethod
6161 def hydrate (cls , person_io : PersonIO ) -> "Person" :
6262 """"""
63- return cls (name = person_io .name , description = person_io .description )
64-
65- def interacts_with (self ):
66- # TODO
67- pass
63+ return cls (
64+ name = person_io .name ,
65+ location = person_io .location ,
66+ description = person_io .description ,
67+ relationships = map (Relationship .hydrate , person_io .relationships ),
68+ )
69+
70+ def interacts_with (self , destination : "Person" , description : str , ** kwargs ):
71+ return self .uses (destination = destination , description = description , ** kwargs )
0 commit comments