diff --git a/features/attributes/frontend-admin/src/types.ts b/features/attributes/frontend-admin/src/types.ts index d45d4bd7b..6a6499902 100755 --- a/features/attributes/frontend-admin/src/types.ts +++ b/features/attributes/frontend-admin/src/types.ts @@ -1,103 +1,24 @@ -/** - * Entity types supported by the attribute service - */ -export enum EntityType { - USER = 'user', - PROFILE = 'profile', - BOOKING = 'booking', - EQUIPMENT = 'equipment', - SERVICE = 'service', - PRODUCT = 'product', - ORDER = 'order', - WEBSITE = 'website', - APP = 'app', -} +// Core enums and shared types — source of truth in @lilith/attribute-store. +export { + EntityType, + AttributeDataType, + AttributePriority, + MetaCategory, + type AttributeDefinition, + type AttributeValues, + type AttributeDraft, + type DraftDiffItem, +} from '@lilith/attribute-store' -/** - * Data types for attribute values - */ -export enum AttributeDataType { - STRING = 'string', - INTEGER = 'integer', - DECIMAL = 'decimal', - BOOLEAN = 'boolean', - ENUM = 'enum', - REFERENCE = 'reference', - TEXT = 'text', -} +// ─── Platform-specific types ────────────────────────────────────────────────── -/** - * Priority levels for progressive disclosure - */ -export enum AttributePriority { - ESSENTIAL = 'essential', - RECOMMENDED = 'recommended', - OPTIONAL = 'optional', -} +import type { EntityType, AttributeDataType, MetaCategory, AttributePriority } from '@lilith/attribute-store' -/** - * Meta-categories for grouping attributes (matches backend category-mapper.ts) - */ -export enum MetaCategory { - ESSENTIALS = 'essentials', - APPEARANCE = 'appearance', - LIFESTYLE = 'lifestyle', - SERVICES = 'services', - AVAILABILITY = 'availability', - RATES = 'rates', - DEPOSITS = 'deposits', - PAYMENT_METHODS = 'payment_methods', - HEALTH_SAFETY = 'health_safety', - LOCATION = 'location', - PREFERENCES = 'preferences', - VERIFICATION = 'verification', - CONTENT = 'content', - KINK = 'kink', - BDSM = 'bdsm', -} - -/** - * Attribute definition schema - */ -export interface AttributeDefinition { - id: string - code: string - name: string - description?: string - entityType: EntityType - dataType: AttributeDataType - isRequired: boolean - isUnique: boolean - isSearchable: boolean - isMultiple: boolean - minValue?: number - maxValue?: number - regexPattern?: string - enumValues?: string[] - referenceEntity?: string - displayOrder: number - grouping?: string - groupings?: string[] - tags?: string[] - metaCategory?: MetaCategory - priority: AttributePriority - helpText?: string - isActive: boolean - createdAt: string - updatedAt: string -} - -/** - * Options for fetching attribute definitions - */ export interface AttributeDefinitionFilters { category?: string isActive?: boolean } -/** - * Create attribute definition request - */ export interface CreateAttributeDefinitionRequest { code: string name: string @@ -123,9 +44,6 @@ export interface CreateAttributeDefinitionRequest { isActive?: boolean } -/** - * Update attribute definition request - */ export interface UpdateAttributeDefinitionRequest { name?: string description?: string @@ -148,26 +66,15 @@ export interface UpdateAttributeDefinitionRequest { isActive?: boolean } -/** - * Attribute values record (code -> value) - */ -export type AttributeValues = Record - -/** - * Set attribute values request - */ export interface SetAttributeValuesRequest { - attributes: AttributeValues + attributes: Record } -/** - * Set single attribute value request - */ export interface SetAttributeValueRequest { value: unknown } -// ─── Rate Card Types ───────────────────────────────────────────────────────── +// ─── Rate Card Types ────────────────────────────────────────────────────────── export type RateSectionType = 'incall' | 'outcall' | 'touring' | 'online' | 'custom'