import { DomainEntity, Result, UniqueID } from "@common/domain"; export interface ITabContextProps { tabId: UniqueID; userId: UniqueID; companyId: UniqueID; branchId: UniqueID; } export interface ITabContext { tabId: UniqueID; userId: UniqueID; companyId: UniqueID; branchId: UniqueID; hasCompanyAssigned(): boolean; hasBranchAssigned(): boolean; toPersistenceData(): any; } export class TabContext extends DomainEntity implements ITabContext { static create(props: ITabContextProps, id?: UniqueID): Result { return Result.ok(new this(props, id)); } get tabId(): UniqueID { return this._props.tabId; } get userId(): UniqueID { return this._props.userId; } get companyId(): UniqueID { return this._props.companyId; } get branchId(): UniqueID { return this._props.branchId; } hasCompanyAssigned(): boolean { return this._props.companyId.isDefined(); } hasBranchAssigned(): boolean { return this._props.branchId.isDefined(); } /** * 🔹 Devuelve una representación lista para persistencia */ toPersistenceData(): any { return { id: this._id.toString(), user_id: this.userId.toString(), company_id: this.companyId.toString(), branchId: this.branchId.toString(), }; } }