import { accessDescSym , EAccess , EExistence , ETargetType , existenceDescSym , IAccessDescriptor , IExistenceDescriptor , TAccessQueryParameter , TOptionalAccessQueryParameter } from "./query.spec" ; import { TObjectProto , TTypeProto } from "../_.spec" ; import { IEntity , TTag } from "../entity.spec" ; import { Entity } from "../entity" ; export function ReadEntity ( uuid ? ) { return Object . assign ( { } , Entity , { [ accessDescSym ] : { data : uuid , target : Entity , targetType : ETargetType . entity , type : EAccess . meta , } , } as IAccessDescriptor < Entity > ) ; } export function Read < C extends Object > ( componentPrototype ) { return Object . assign ( { } , componentPrototype . prototype , { [ accessDescSym ] : { optional : false , target : componentPrototype , targetType : ETargetType . component , type : EAccess . read , } , } as IAccessDescriptor < C > ) ; } export function ReadOptional < C extends Object > ( componentPrototype ) { return Object . assign ( { } , componentPrototype . prototype , { [ accessDescSym ] : { optional : true , target : componentPrototype , targetType : ETargetType . component , type : EAccess . read , } , } as IAccessDescriptor < C > ) ; } export function Write < C extends Object > ( componentPrototype ) { return Object . assign ( { } , componentPrototype . prototype , { [ accessDescSym ] : { optional : false , target : componentPrototype , targetType : ETargetType . component , type : EAccess . write , } , } as IAccessDescriptor < C > ) ; } export function WriteOptional < C extends Object > ( componentPrototype ) { return Object . assign ( { } , componentPrototype . prototype , { [ accessDescSym ] : { optional : true , target : componentPrototype , targetType : ETargetType . component , type : EAccess . write , } , } as IAccessDescriptor < C > ) ; } export function With < C extends Object > ( componentPrototype ) { return { [ existenceDescSym ] : { target : componentPrototype , targetType : ETargetType . component , type : EExistence . set , } } ; } export function WithTag ( tag ) { return { [ accessDescSym ] : { optional : false , target : tag , targetType : ETargetType . tag , type : EAccess . meta , } , [ existenceDescSym ] : { target : tag , targetType : ETargetType . tag , type : EExistence . set , } } as TAccessQueryParameter < TObjectProto > & IExistenceDescriptor < TObjectProto > ; } export function Without < C extends Object > ( componentPrototype ) { return { [ existenceDescSym ] : { target : componentPrototype , targetType : ETargetType . component , type : EExistence . unset , } } ; } export function WithoutTag ( tag ) { return { [ existenceDescSym ] : { target : tag , targetType : ETargetType . tag , type : EExistence . unset , } } ; }