Blame | Last modification | View Log | RSS feed
package com.spice.profitmandi.common.model;import java.util.Objects;/*** Staff member acting on a partner's behalf. A null Actor means the partner is acting themself.*/public final class Actor {private final int authUserId;private final String authUserEmail;private final Long launchId;private Actor(int authUserId, String authUserEmail, Long launchId) {this.authUserId = authUserId;this.authUserEmail = authUserEmail;this.launchId = launchId;}public static Actor of(int authUserId, String authUserEmail, Long launchId) {return new Actor(authUserId, authUserEmail, launchId);}/** Staff fields present in the token → Actor; otherwise null (the partner themself). */public static Actor from(UserInfo userInfo) {if (userInfo == null || userInfo.getAuthUserId() <= 0) {return null;}return new Actor(userInfo.getAuthUserId(), userInfo.getAuthUserEmail(), userInfo.getLaunchId());}public Actor withLaunch(long launchId) {return new Actor(authUserId, authUserEmail, launchId);}public int getAuthUserId() {return authUserId;}public String getAuthUserEmail() {return authUserEmail;}public Long getLaunchId() {return launchId;}@Overridepublic boolean equals(Object o) {if (this == o) return true;if (!(o instanceof Actor)) return false;Actor actor = (Actor) o;return authUserId == actor.authUserId && Objects.equals(launchId, actor.launchId);}@Overridepublic int hashCode() {return Objects.hash(authUserId, launchId);}@Overridepublic String toString() {return "Actor[authUserId=" + authUserId + ", authUserEmail=" + authUserEmail + ", launchId=" + launchId + "]";}}