import { get, set } from '@dikolab/private-parts'; import { TITLE_KEY } from '../../utils/constants/symbol-keys.constant'; import { defineActor } from '../../actor/functions/define-actor.function'; /** * Fluent chain for defining an actor by name * and assigning roles */ export class IAmChain { get [TITLE_KEY](): ActorName { // eslint-disable-next-line @typescript-eslint/no-unsafe-return return get(this, TITLE_KEY); } constructor(actorName: ActorName) { set(this, TITLE_KEY, actorName); } /** * Defines an Actor with the given Roles. * * @param roles Roles to attach * @returns Actor */ as(...roles: RoleNames) { return defineActor(this[TITLE_KEY], ...roles); } }