using ServerBase; using ServerCommon; using ServerCore; namespace BrokerApiCore; public sealed class PlanetUserEntity : EntityBase, IWithLogActor { private readonly DynamoDbClient m_dynamo_db_client; private readonly IServerLogic m_server_logic; private string m_planet_id = string.Empty; // private BrokerMail m_broker_mail = null!; public string AccountId => this.getEntityAttributeNotNull().AccountId; public string UserGuid => this.getEntityAttributeNotNull().UserGuid; public string Nickname => this.getEntityAttributeNotNull().Nickname; public PlanetUserEntity(IServerLogic serverLogic) : base(EntityType.PlanetUser) { m_server_logic = serverLogic; m_dynamo_db_client = serverLogic.getDynamoDbClient(); } public override OwnerEntityType onGetOwnerEntityType() { return OwnerEntityType.User; } public override async Task onInit() { try { addEntityAttribute(new UserAttribute(this)); addEntityAttribute(new NicknameAttribute(this)); addEntityAction(new UserAuthAction(this, m_dynamo_db_client)); addEntityAttribute(new AccountAttribute(this)); } catch (Exception ex) { Log.getLogger().Error(ex, $"{nameof(PlanetUserEntity)}.onInit() Exception => {ex.Message}"); } return await base.onInit(); } public void setPlanetId(string planetId) { m_planet_id = planetId; } // IWithLogActor 구현 public ILogActor toLogActor() { var account = this.getEntityAttributeNotNull(); var nickname = this.getEntityAttributeNotNull(); var log_actor = new PlanetUserLogActor { ServerType = m_server_logic.getServerType().toServerType(), PlanetId = m_planet_id, AccountType = account.AccountType, AccountId = account.AccountId, AccountIdString = account.AccountIdString, UserNickname = nickname.Nickname, UserGuid = account.UserGuid, }; return log_actor; } }