import { Keys, Extends, PropSelector, SpecialType, Settings, InfoMap, Status, Info, } from "@onebro/oba-common"; import { Model, ModelSignature, ModelBaseTypeSig, Stages, StageGuard, IsObjectId, } from "@onebro/oba-mongoose"; import {UserStatuses,UserRoles} from "./00-common"; import {UploadAsProp} from "./02-upload"; export type UserAcctTypes = {T1:"SLV1";T2:"GLD1";T3:"GLD2";T4:"PLT1";}; export const UserAcctTypes = {T1:"SLV1",T2:"GLD1",T3:"GLD2",T4:"PLT1"}; export type UserProfileProps = Record<"name"|"bio"|"motto",string> & SpecialType,"role"> & { _type_:"user-profile"; img:UploadAsProp[t]; settings:Settings & Info<"data">; socials:InfoMap>; stats:InfoMap>; rating:number; activity:Status>[]; memberSince:Date; }; export type UserProfileConfigKeys = |"name"|"role"; export type UserProfileConfigOptKeys = |"img"|"bio"|"motto"|"rating"|"settings"|"socials"|"stats"|"activity"; export type UserProfileInstanceKeys = UserProfileConfigKeys|UserProfileConfigOptKeys; export type UserProfileJsonKeys = UserProfileInstanceKeys|"_type_"|"memberSince"; export type UserProfilePreviewKeys = |"name"|"img"|"memberSince"; export type UserProfileSelfRefs = { followers:{out:"P";arr:1}; following:{out:"P";arr:true}; endorsements:{out:"P";arr:true}; }; export type UserProfileMethods = {}; export type UserProfilePropKeys = Keys>; export type UserProfilePropSelector< t extends Stages, k extends UserProfilePropKeys = undefined, j extends UserProfilePropKeys = undefined> = PropSelector,k,j>; export type UserProfileSignature = ModelSignature< UserProfilePropSelector<"C",UserProfileConfigKeys,UserProfileConfigOptKeys>, UserProfilePropSelector<"I",UserProfileInstanceKeys> & UserProfileMethods, UserProfilePropSelector<"J",UserProfileJsonKeys>, UserProfilePropSelector<"J",UserProfilePreviewKeys>, UserStatuses, UserProfileSelfRefs>; export type UserProfile = Model; export type UserProfileAsProp = ModelBaseTypeSig< Extends<[IsArr],[true|1],IsObjectId[],IsObjectId>, Extends<[IsArr],[true|1],UserProfile["instance"][],UserProfile["instance"]>, Extends<[IsArr],[true|1], Extends<[IsUser],[true|1],UserProfile["json"][],UserProfile["preview"][]>, Extends<[IsUser],[true|1],UserProfile["json"],UserProfile["preview"]>>>; export type UserProfileSocials = { s1:"fb"; s2:"twtr"; s3:"goog"; s4:"reddit"; s5:"pin"; }; export const UserProfileSocials:UserProfileSocials = { s1:"fb", s2:"twtr", s3:"goog", s4:"reddit", s5:"pin", }; export type UserProfileStats = {s1:"views";}; export const UserProfileStats:UserProfileStats = {s1:"views"}; export type UserProfileActions = { a1:"create-profile"; a2:"update-profile"; a3:"update-profile-pic"; a4:"sent-message"; }; export const UserProfileActions:UserProfileActions = { a1:"create-profile", a2:"update-profile", a3:"update-profile-pic", a4:"sent-message", }; export type UserProfileSettings = {optionsOnly:boolean;withBal:boolean;};