"""Models of accounts, users, user profiles and account contacts, as ``/api/v1/accounts/`` returns them."""fromdatetimeimportdatetimefromtypingimportOptionalfrompydanticimportFieldfrom.baseimportSmarterAccountRef,SmarterCamelModel,SmarterResource
[docs]classAccount(SmarterResource):"""A Smarter account: the tenant that owns users and resources."""account_number:stris_default_account:Optional[bool]=Nonecompany_name:Optional[str]=Nonephone_number:Optional[str]=Noneaddress1:Optional[str]=Noneaddress2:Optional[str]=Nonecity:Optional[str]=Nonestate:Optional[str]=Nonepostal_code:Optional[str]=Nonecountry:Optional[str]=Nonelanguage:Optional[str]=Nonetimezone:Optional[str]=Nonecurrency:Optional[str]=Noneis_active:Optional[bool]=None
[docs]classUser(SmarterCamelModel):"""A user of the platform."""id:intusername:strfirst_name:Optional[str]=Nonelast_name:Optional[str]=Noneemail:Optional[str]=Noneis_staff:Optional[bool]=Noneis_superuser:Optional[bool]=None
[docs]classUserProfile(SmarterResource):"""A user's membership of an account, which owns the resources that the user creates in it."""user:Useraccount:SmarterAccountRefprofile_image:Optional[str]=Field(None,description="The url of the image that the user uploaded, which takes precedence over profile_image_url.")profile_image_url:Optional[str]=Field(None,description="The url of the image that the oauth provider supplied.")is_test:Optional[bool]=None
[docs]classAccountContact(SmarterCamelModel):"""A contact of an account, who receives its notices."""id:intaccount:Optional[SmarterAccountRef]=Nonecreated_at:Optional[datetime]=Noneupdated_at:Optional[datetime]=Nonefirst_name:Optional[str]=Nonelast_name:Optional[str]=Noneemail:Optional[str]=Nonephone:Optional[str]=Noneis_primary:Optional[bool]=Noneis_test:Optional[bool]=Nonewelcomed:Optional[bool]=None