/**
 * Gaming Domain Template
 *
 * A comprehensive gaming data domain following domain-driven design principles.
 * This template covers the complete gaming ecosystem lifecycle including:
 *
 * - Player Management: Player profiles, achievements, statistics
 * - Game Content: Levels, items, characters, assets
 * - Matchmaking: Multiplayer, teams, tournaments
 * - Monetization: In-app purchases, subscriptions, advertising
 * - Analytics: Player behavior, engagement, retention
 * - Social Features: Friends, chat, leaderboards
 *
 * Key Features:
 * - Complete player lifecycle management
 * - Game content and asset management
 * - Multiplayer matchmaking system
 * - Monetization and revenue tracking
 * - Player analytics and insights
 * - Social gaming features
 * - Gaming ecosystem management
 *
 * Use Cases:
 * - Video game platforms
 * - Mobile gaming apps
 * - Online multiplayer games
 * - Game development studios
 * - Gaming analytics
 * - Social gaming networks
 */
import { DataDomain } from '../../../DataDomain.js';
import { addIdField, addNameField, addDescriptionField, addEmailField, addCustomStatusField, addCreatedAtField, addUpdatedAtField, addCurrencyAmountField, } from '../../../helpers/Intelisense.js';
function createDomain() {
    return new DataDomain({
        info: {
            name: 'Gaming Platform',
            displayName: 'Gaming Platform',
            description: 'A comprehensive gaming platform with player management, game content, ' +
                'matchmaking, monetization, analytics, and social features',
        },
    });
}
/**
 * Creates a comprehensive gaming data domain following domain-driven design principles.
 *
 * This function demonstrates the proper hierarchy and organization for a gaming platform:
 * 1. Creates the root DataDomain for the gaming platform
 * 2. Organizes functionality into logical namespaces (Player Management, Game Content, etc.)
 * 3. Groups related entities into models within each namespace
 * 4. Defines entities with proper semantic annotations for gaming workflows
 * 5. Establishes associations with appropriate cardinality for gaming relationships
 *
 * @returns A fully configured DataDomain with all gaming entities and relationships
 */
export default function createGamingDomain(options = {}) {
    // Ensure the root data domain
    const domain = options.domain ?? createDomain();
    //
    // 1. PLAYER MANAGEMENT NAMESPACE
    //
    const playerManagement = domain.addNamespace({
        info: {
            name: 'PlayerManagement',
            displayName: 'Player Management',
            description: 'Player profiles, achievements, and statistics',
        },
    });
    // Player Model
    const playerModel = playerManagement.addModel({
        info: {
            name: 'Players',
            displayName: 'Player Management',
            description: 'Player profiles and management',
        },
    });
    // Player Entity
    const playerEntity = playerModel.addEntity({
        info: {
            name: 'player',
            displayName: 'Player',
            description: 'Game player with profile and statistics',
        },
    });
    addIdField(playerEntity, { displayName: 'Player ID', description: 'Unique identifier for the player' });
    addNameField(playerEntity, { description: 'Player name and display name' });
    addDescriptionField(playerEntity, { description: 'Player description and bio' });
    addEmailField(playerEntity, { description: 'Player email address' });
    playerEntity.addProperty({
        info: { name: 'username', displayName: 'Username', description: 'Player username' },
        type: 'string',
        required: true,
        unique: true,
    });
    playerEntity.addProperty({
        info: { name: 'player_type', displayName: 'Player Type', description: 'Type of player' },
        type: 'string',
        required: true,
        schema: {
            enum: ['casual', 'competitive', 'professional', 'streamer', 'content_creator'],
        },
    });
    playerEntity.addProperty({
        info: { name: 'date_of_birth', displayName: 'Date of Birth', description: 'Player date of birth' },
        type: 'date',
        required: false,
    });
    playerEntity.addProperty({
        info: { name: 'country', displayName: 'Country', description: 'Player country' },
        type: 'string',
        required: false,
    });
    playerEntity.addProperty({
        info: { name: 'timezone', displayName: 'Timezone', description: 'Player timezone' },
        type: 'string',
        required: false,
    });
    addCustomStatusField(playerEntity, ['active', 'inactive', 'banned', 'suspended'], {
        displayName: 'Player Status',
        description: 'Current status of the player',
    });
    addCreatedAtField(playerEntity, { description: 'When the player was created' });
    addUpdatedAtField(playerEntity, { description: 'When the player was last updated' });
    // Achievement Entity
    const achievementEntity = playerModel.addEntity({
        info: {
            name: 'achievement',
            displayName: 'Achievement',
            description: 'Player achievements and accomplishments',
        },
    });
    addIdField(achievementEntity, { displayName: 'Achievement ID', description: 'Unique identifier for the achievement' });
    addNameField(achievementEntity, { description: 'Achievement name and title' });
    addDescriptionField(achievementEntity, { description: 'Achievement description and requirements' });
    achievementEntity.addProperty({
        info: { name: 'achievement_type', displayName: 'Achievement Type', description: 'Type of achievement' },
        type: 'string',
        required: true,
        schema: {
            enum: ['milestone', 'collection', 'challenge', 'social', 'competitive', 'hidden'],
        },
    });
    achievementEntity.addProperty({
        info: { name: 'points', displayName: 'Points', description: 'Achievement points value' },
        type: 'number',
        required: true,
        schema: {
            minimum: 0,
        },
    });
    achievementEntity.addProperty({
        info: { name: 'rarity', displayName: 'Rarity', description: 'Achievement rarity level' },
        type: 'string',
        required: true,
        schema: {
            enum: ['common', 'uncommon', 'rare', 'epic', 'legendary'],
        },
    });
    addCustomStatusField(achievementEntity, ['available', 'unlocked', 'locked'], {
        displayName: 'Achievement Status',
        description: 'Current status of the achievement',
    });
    addCreatedAtField(achievementEntity, { description: 'When the achievement was created' });
    // Achievement-Player Association (Many-to-One)
    achievementEntity.addAssociation({ key: playerEntity.key }, {
        info: { name: 'player', displayName: 'Player', description: 'Player for this achievement' },
        required: true,
        multiple: false,
    });
    // Statistics Entity
    const statisticsEntity = playerModel.addEntity({
        info: {
            name: 'statistics',
            displayName: 'Statistics',
            description: 'Player game statistics',
        },
    });
    addIdField(statisticsEntity, { displayName: 'Statistics ID', description: 'Unique identifier for the statistics' });
    addNameField(statisticsEntity, { description: 'Statistics name and description' });
    statisticsEntity.addProperty({
        info: { name: 'stat_type', displayName: 'Stat Type', description: 'Type of statistic' },
        type: 'string',
        required: true,
        schema: {
            enum: ['score', 'time_played', 'wins', 'losses', 'accuracy', 'level', 'experience'],
        },
    });
    statisticsEntity.addProperty({
        info: { name: 'value', displayName: 'Value', description: 'Statistic value' },
        type: 'number',
        required: true,
    });
    statisticsEntity.addProperty({
        info: { name: 'unit', displayName: 'Unit', description: 'Statistic unit' },
        type: 'string',
        required: false,
    });
    addCustomStatusField(statisticsEntity, ['current', 'historical', 'best'], {
        displayName: 'Statistics Status',
        description: 'Current status of the statistics',
    });
    addCreatedAtField(statisticsEntity, { description: 'When the statistics was created' });
    // Statistics-Player Association (Many-to-One)
    statisticsEntity.addAssociation({ key: playerEntity.key }, {
        info: { name: 'player', displayName: 'Player', description: 'Player for this statistics' },
        required: true,
        multiple: false,
    });
    //
    // 2. GAME CONTENT NAMESPACE
    //
    const gameContent = domain.addNamespace({
        info: {
            name: 'GameContent',
            displayName: 'Game Content',
            description: 'Levels, items, characters, and assets',
        },
    });
    // Content Model
    const contentModel = gameContent.addModel({
        info: {
            name: 'Content',
            displayName: 'Game Content Management',
            description: 'Game content and assets',
        },
    });
    // Level Entity
    const levelEntity = contentModel.addEntity({
        info: {
            name: 'level',
            displayName: 'Level',
            description: 'Game level or stage',
        },
    });
    addIdField(levelEntity, { displayName: 'Level ID', description: 'Unique identifier for the level' });
    addNameField(levelEntity, { description: 'Level name and title' });
    addDescriptionField(levelEntity, { description: 'Level description and objectives' });
    levelEntity.addProperty({
        info: { name: 'level_type', displayName: 'Level Type', description: 'Type of level' },
        type: 'string',
        required: true,
        schema: {
            enum: ['tutorial', 'story', 'challenge', 'boss', 'multiplayer', 'custom'],
        },
    });
    levelEntity.addProperty({
        info: { name: 'difficulty', displayName: 'Difficulty', description: 'Level difficulty' },
        type: 'string',
        required: true,
        schema: {
            enum: ['easy', 'normal', 'hard', 'expert', 'nightmare'],
        },
    });
    levelEntity.addProperty({
        info: { name: 'order', displayName: 'Order', description: 'Level order in sequence' },
        type: 'number',
        required: true,
        schema: {
            minimum: 1,
        },
    });
    levelEntity.addProperty({
        info: { name: 'time_limit', displayName: 'Time Limit', description: 'Level time limit in seconds' },
        type: 'number',
        required: false,
        schema: {
            minimum: 0,
        },
    });
    addCustomStatusField(levelEntity, ['draft', 'testing', 'published', 'archived'], {
        displayName: 'Level Status',
        description: 'Current status of the level',
    });
    addCreatedAtField(levelEntity, { description: 'When the level was created' });
    // Item Entity
    const itemEntity = contentModel.addEntity({
        info: {
            name: 'item',
            displayName: 'Item',
            description: 'Game item or collectible',
        },
    });
    addIdField(itemEntity, { displayName: 'Item ID', description: 'Unique identifier for the item' });
    addNameField(itemEntity, { description: 'Item name and title' });
    addDescriptionField(itemEntity, { description: 'Item description and effects' });
    itemEntity.addProperty({
        info: { name: 'item_type', displayName: 'Item Type', description: 'Type of item' },
        type: 'string',
        required: true,
        schema: {
            enum: ['weapon', 'armor', 'consumable', 'collectible', 'currency', 'cosmetic'],
        },
    });
    itemEntity.addProperty({
        info: { name: 'rarity', displayName: 'Rarity', description: 'Item rarity level' },
        type: 'string',
        required: true,
        schema: {
            enum: ['common', 'uncommon', 'rare', 'epic', 'legendary'],
        },
    });
    itemEntity.addProperty({
        info: { name: 'value', displayName: 'Value', description: 'Item value or cost' },
        type: 'number',
        required: false,
        schema: {
            minimum: 0,
        },
    });
    addCustomStatusField(itemEntity, ['available', 'unlocked', 'locked', 'consumed'], {
        displayName: 'Item Status',
        description: 'Current status of the item',
    });
    addCreatedAtField(itemEntity, { description: 'When the item was created' });
    // Character Entity
    const characterEntity = contentModel.addEntity({
        info: {
            name: 'character',
            displayName: 'Character',
            description: 'Game character or avatar',
        },
    });
    addIdField(characterEntity, { displayName: 'Character ID', description: 'Unique identifier for the character' });
    addNameField(characterEntity, { description: 'Character name and title' });
    addDescriptionField(characterEntity, { description: 'Character description and backstory' });
    characterEntity.addProperty({
        info: { name: 'character_type', displayName: 'Character Type', description: 'Type of character' },
        type: 'string',
        required: true,
        schema: {
            enum: ['hero', 'villain', 'npc', 'boss', 'companion', 'custom'],
        },
    });
    characterEntity.addProperty({
        info: { name: 'class', displayName: 'Class', description: 'Character class or role' },
        type: 'string',
        required: false,
    });
    characterEntity.addProperty({
        info: { name: 'level', displayName: 'Level', description: 'Character level' },
        type: 'number',
        required: true,
        schema: {
            minimum: 1,
        },
    });
    addCustomStatusField(characterEntity, ['available', 'unlocked', 'locked'], {
        displayName: 'Character Status',
        description: 'Current status of the character',
    });
    addCreatedAtField(characterEntity, { description: 'When the character was created' });
    // Asset Entity
    const assetEntity = contentModel.addEntity({
        info: {
            name: 'asset',
            displayName: 'Asset',
            description: 'Game asset (image, sound, model)',
        },
    });
    addIdField(assetEntity, { displayName: 'Asset ID', description: 'Unique identifier for the asset' });
    addNameField(assetEntity, { description: 'Asset name and title' });
    addDescriptionField(assetEntity, { description: 'Asset description and usage' });
    assetEntity.addProperty({
        info: { name: 'asset_type', displayName: 'Asset Type', description: 'Type of asset' },
        type: 'string',
        required: true,
        schema: {
            enum: ['image', 'sound', 'model', 'animation', 'texture', 'video'],
        },
    });
    assetEntity.addProperty({
        info: { name: 'file_path', displayName: 'File Path', description: 'Asset file path' },
        type: 'string',
        required: true,
    });
    assetEntity.addProperty({
        info: { name: 'file_size', displayName: 'File Size', description: 'Asset file size in bytes' },
        type: 'number',
        required: true,
        schema: {
            minimum: 0,
        },
    });
    assetEntity.addProperty({
        info: { name: 'format', displayName: 'Format', description: 'Asset file format' },
        type: 'string',
        required: true,
    });
    addCustomStatusField(assetEntity, ['draft', 'review', 'approved', 'published'], {
        displayName: 'Asset Status',
        description: 'Current status of the asset',
    });
    addCreatedAtField(assetEntity, { description: 'When the asset was created' });
    //
    // 3. MATCHMAKING NAMESPACE
    //
    const matchmaking = domain.addNamespace({
        info: {
            name: 'Matchmaking',
            displayName: 'Matchmaking',
            description: 'Multiplayer, teams, and tournaments',
        },
    });
    // Matchmaking Model
    const matchmakingModel = matchmaking.addModel({
        info: {
            name: 'Matchmaking',
            displayName: 'Matchmaking Management',
            description: 'Multiplayer matchmaking and teams',
        },
    });
    // Match Entity
    const matchEntity = matchmakingModel.addEntity({
        info: {
            name: 'match',
            displayName: 'Match',
            description: 'Game match or session',
        },
    });
    addIdField(matchEntity, { displayName: 'Match ID', description: 'Unique identifier for the match' });
    addNameField(matchEntity, { description: 'Match name and description' });
    addDescriptionField(matchEntity, { description: 'Match description and details' });
    matchEntity.addProperty({
        info: { name: 'match_type', displayName: 'Match Type', description: 'Type of match' },
        type: 'string',
        required: true,
        schema: {
            enum: ['casual', 'ranked', 'tournament', 'private', 'practice'],
        },
    });
    matchEntity.addProperty({
        info: { name: 'game_mode', displayName: 'Game Mode', description: 'Game mode' },
        type: 'string',
        required: true,
        schema: {
            enum: ['deathmatch', 'team_deathmatch', 'capture_the_flag', 'domination', 'survival'],
        },
    });
    matchEntity.addProperty({
        info: { name: 'start_time', displayName: 'Start Time', description: 'Match start time' },
        type: 'datetime',
        required: true,
    });
    matchEntity.addProperty({
        info: { name: 'end_time', displayName: 'End Time', description: 'Match end time' },
        type: 'datetime',
        required: false,
    });
    matchEntity.addProperty({
        info: { name: 'max_players', displayName: 'Max Players', description: 'Maximum players in match' },
        type: 'number',
        required: true,
        schema: {
            minimum: 1,
        },
    });
    addCustomStatusField(matchEntity, ['waiting', 'in_progress', 'completed', 'cancelled'], {
        displayName: 'Match Status',
        description: 'Current status of the match',
    });
    addCreatedAtField(matchEntity, { description: 'When the match was created' });
    // Match-Player Association (Many-to-Many)
    matchEntity.addAssociation({ key: playerEntity.key }, {
        info: { name: 'players', displayName: 'Players', description: 'Players in this match' },
        required: true,
        multiple: true,
    });
    // Team Entity
    const teamEntity = matchmakingModel.addEntity({
        info: {
            name: 'team',
            displayName: 'Team',
            description: 'Player team or squad',
        },
    });
    addIdField(teamEntity, { displayName: 'Team ID', description: 'Unique identifier for the team' });
    addNameField(teamEntity, { description: 'Team name and title' });
    addDescriptionField(teamEntity, { description: 'Team description and objectives' });
    teamEntity.addProperty({
        info: { name: 'team_type', displayName: 'Team Type', description: 'Type of team' },
        type: 'string',
        required: true,
        schema: {
            enum: ['casual', 'competitive', 'clan', 'guild', 'tournament'],
        },
    });
    teamEntity.addProperty({
        info: { name: 'max_members', displayName: 'Max Members', description: 'Maximum team members' },
        type: 'number',
        required: true,
        schema: {
            minimum: 1,
        },
    });
    addCustomStatusField(teamEntity, ['active', 'inactive', 'disbanded'], {
        displayName: 'Team Status',
        description: 'Current status of the team',
    });
    addCreatedAtField(teamEntity, { description: 'When the team was created' });
    // Team-Player Association (Many-to-Many)
    teamEntity.addAssociation({ key: playerEntity.key }, {
        info: { name: 'members', displayName: 'Members', description: 'Team members' },
        required: true,
        multiple: true,
    });
    // Tournament Entity
    const tournamentEntity = matchmakingModel.addEntity({
        info: {
            name: 'tournament',
            displayName: 'Tournament',
            description: 'Game tournament or competition',
        },
    });
    addIdField(tournamentEntity, { displayName: 'Tournament ID', description: 'Unique identifier for the tournament' });
    addNameField(tournamentEntity, { description: 'Tournament name and title' });
    addDescriptionField(tournamentEntity, { description: 'Tournament description and rules' });
    tournamentEntity.addProperty({
        info: { name: 'tournament_type', displayName: 'Tournament Type', description: 'Type of tournament' },
        type: 'string',
        required: true,
        schema: {
            enum: ['single_elimination', 'double_elimination', 'round_robin', 'swiss', 'bracket'],
        },
    });
    tournamentEntity.addProperty({
        info: { name: 'start_date', displayName: 'Start Date', description: 'Tournament start date' },
        type: 'date',
        required: true,
    });
    tournamentEntity.addProperty({
        info: { name: 'end_date', displayName: 'End Date', description: 'Tournament end date' },
        type: 'date',
        required: true,
    });
    tournamentEntity.addProperty({
        info: { name: 'max_participants', displayName: 'Max Participants', description: 'Maximum participants' },
        type: 'number',
        required: true,
        schema: {
            minimum: 2,
        },
    });
    addCurrencyAmountField(tournamentEntity, 'prize_pool', 'Prize Pool', {
        description: 'Tournament prize pool amount',
    });
    addCustomStatusField(tournamentEntity, ['registration_open', 'in_progress', 'completed', 'cancelled'], {
        displayName: 'Tournament Status',
        description: 'Current status of the tournament',
    });
    addCreatedAtField(tournamentEntity, { description: 'When the tournament was created' });
    // Tournament-Player Association (Many-to-Many)
    tournamentEntity.addAssociation({ key: playerEntity.key }, {
        info: { name: 'participants', displayName: 'Participants', description: 'Tournament participants' },
        required: true,
        multiple: true,
    });
    //
    // 4. MONETIZATION NAMESPACE
    //
    const monetization = domain.addNamespace({
        info: {
            name: 'Monetization',
            displayName: 'Monetization',
            description: 'In-app purchases, subscriptions, and advertising',
        },
    });
    // Monetization Model
    const monetizationModel = monetization.addModel({
        info: {
            name: 'Monetization',
            displayName: 'Monetization Management',
            description: 'Revenue and monetization tracking',
        },
    });
    // Purchase Entity
    const purchaseEntity = monetizationModel.addEntity({
        info: {
            name: 'purchase',
            displayName: 'Purchase',
            description: 'In-app purchase transaction',
        },
    });
    addIdField(purchaseEntity, { displayName: 'Purchase ID', description: 'Unique identifier for the purchase' });
    addNameField(purchaseEntity, { description: 'Purchase name and description' });
    purchaseEntity.addProperty({
        info: { name: 'purchase_type', displayName: 'Purchase Type', description: 'Type of purchase' },
        type: 'string',
        required: true,
        schema: {
            enum: ['item', 'currency', 'subscription', 'battle_pass', 'cosmetic'],
        },
    });
    purchaseEntity.addProperty({
        info: { name: 'purchase_date', displayName: 'Purchase Date', description: 'Purchase date' },
        type: 'datetime',
        required: true,
    });
    purchaseEntity.addProperty({
        info: { name: 'payment_method', displayName: 'Payment Method', description: 'Payment method used' },
        type: 'string',
        required: true,
        schema: {
            enum: ['credit_card', 'paypal', 'apple_pay', 'google_pay', 'gift_card'],
        },
    });
    addCurrencyAmountField(purchaseEntity, 'amount', 'Purchase Amount', {
        description: 'Purchase amount',
    });
    addCustomStatusField(purchaseEntity, ['pending', 'completed', 'failed', 'refunded'], {
        displayName: 'Purchase Status',
        description: 'Current status of the purchase',
    });
    addCreatedAtField(purchaseEntity, { description: 'When the purchase was created' });
    // Purchase-Player Association (Many-to-One)
    purchaseEntity.addAssociation({ key: playerEntity.key }, {
        info: { name: 'player', displayName: 'Player', description: 'Player for this purchase' },
        required: true,
        multiple: false,
    });
    // Subscription Entity
    const subscriptionEntity = monetizationModel.addEntity({
        info: {
            name: 'subscription',
            displayName: 'Subscription',
            description: 'Player subscription',
        },
    });
    addIdField(subscriptionEntity, {
        displayName: 'Subscription ID',
        description: 'Unique identifier for the subscription',
    });
    addNameField(subscriptionEntity, { description: 'Subscription name and description' });
    subscriptionEntity.addProperty({
        info: { name: 'subscription_type', displayName: 'Subscription Type', description: 'Type of subscription' },
        type: 'string',
        required: true,
        schema: {
            enum: ['monthly', 'quarterly', 'annual', 'lifetime', 'premium'],
        },
    });
    subscriptionEntity.addProperty({
        info: { name: 'start_date', displayName: 'Start Date', description: 'Subscription start date' },
        type: 'date',
        required: true,
    });
    subscriptionEntity.addProperty({
        info: { name: 'end_date', displayName: 'End Date', description: 'Subscription end date' },
        type: 'date',
        required: true,
    });
    addCurrencyAmountField(subscriptionEntity, 'amount', 'Subscription Amount', {
        description: 'Subscription amount',
    });
    addCustomStatusField(subscriptionEntity, ['active', 'expired', 'cancelled', 'pending'], {
        displayName: 'Subscription Status',
        description: 'Current status of the subscription',
    });
    addCreatedAtField(subscriptionEntity, { description: 'When the subscription was created' });
    // Subscription-Player Association (Many-to-One)
    subscriptionEntity.addAssociation({ key: playerEntity.key }, {
        info: { name: 'player', displayName: 'Player', description: 'Player for this subscription' },
        required: true,
        multiple: false,
    });
    // Advertisement Entity
    const advertisementEntity = monetizationModel.addEntity({
        info: {
            name: 'advertisement',
            displayName: 'Advertisement',
            description: 'Game advertisement',
        },
    });
    addIdField(advertisementEntity, { displayName: 'Ad ID', description: 'Unique identifier for the advertisement' });
    addNameField(advertisementEntity, { description: 'Advertisement name and title' });
    addDescriptionField(advertisementEntity, { description: 'Advertisement description and content' });
    advertisementEntity.addProperty({
        info: { name: 'ad_type', displayName: 'Ad Type', description: 'Type of advertisement' },
        type: 'string',
        required: true,
        schema: {
            enum: ['banner', 'interstitial', 'rewarded', 'native', 'video'],
        },
    });
    advertisementEntity.addProperty({
        info: { name: 'placement', displayName: 'Placement', description: 'Ad placement location' },
        type: 'string',
        required: true,
    });
    advertisementEntity.addProperty({
        info: { name: 'impressions', displayName: 'Impressions', description: 'Number of ad impressions' },
        type: 'number',
        required: true,
        schema: {
            minimum: 0,
        },
    });
    advertisementEntity.addProperty({
        info: { name: 'clicks', displayName: 'Clicks', description: 'Number of ad clicks' },
        type: 'number',
        required: true,
        schema: {
            minimum: 0,
        },
    });
    addCurrencyAmountField(advertisementEntity, 'revenue', 'Ad Revenue', {
        description: 'Advertisement revenue',
    });
    addCustomStatusField(advertisementEntity, ['active', 'paused', 'completed', 'cancelled'], {
        displayName: 'Ad Status',
        description: 'Current status of the advertisement',
    });
    addCreatedAtField(advertisementEntity, { description: 'When the advertisement was created' });
    //
    // 5. ANALYTICS NAMESPACE
    //
    const analytics = domain.addNamespace({
        info: {
            name: 'Analytics',
            displayName: 'Analytics',
            description: 'Player behavior, engagement, and retention',
        },
    });
    // Analytics Model
    const analyticsModel = analytics.addModel({
        info: {
            name: 'Analytics',
            displayName: 'Analytics Management',
            description: 'Player analytics and insights',
        },
    });
    // Player Behavior Entity
    const playerBehaviorEntity = analyticsModel.addEntity({
        info: {
            name: 'player_behavior',
            displayName: 'Player Behavior',
            description: 'Player behavior analytics',
        },
    });
    addIdField(playerBehaviorEntity, {
        displayName: 'Behavior ID',
        description: 'Unique identifier for the player behavior',
    });
    addNameField(playerBehaviorEntity, { description: 'Behavior name and description' });
    playerBehaviorEntity.addProperty({
        info: { name: 'behavior_type', displayName: 'Behavior Type', description: 'Type of behavior' },
        type: 'string',
        required: true,
        schema: {
            enum: ['session_duration', 'purchase_frequency', 'game_completion', 'social_interaction', 'feature_usage'],
        },
    });
    playerBehaviorEntity.addProperty({
        info: { name: 'session_date', displayName: 'Session Date', description: 'Behavior session date' },
        type: 'date',
        required: true,
    });
    playerBehaviorEntity.addProperty({
        info: { name: 'duration', displayName: 'Duration', description: 'Behavior duration in minutes' },
        type: 'number',
        required: true,
        schema: {
            minimum: 0,
        },
    });
    addCustomStatusField(playerBehaviorEntity, ['tracked', 'analyzed', 'reported'], {
        displayName: 'Behavior Status',
        description: 'Current status of the behavior tracking',
    });
    addCreatedAtField(playerBehaviorEntity, { description: 'When the behavior was created' });
    // PlayerBehavior-Player Association (Many-to-One)
    playerBehaviorEntity.addAssociation({ key: playerEntity.key }, {
        info: { name: 'player', displayName: 'Player', description: 'Player for this behavior' },
        required: true,
        multiple: false,
    });
    // Engagement Entity
    const engagementEntity = analyticsModel.addEntity({
        info: {
            name: 'engagement',
            displayName: 'Engagement',
            description: 'Player engagement metrics',
        },
    });
    addIdField(engagementEntity, { displayName: 'Engagement ID', description: 'Unique identifier for the engagement' });
    addNameField(engagementEntity, { description: 'Engagement name and description' });
    engagementEntity.addProperty({
        info: { name: 'engagement_type', displayName: 'Engagement Type', description: 'Type of engagement' },
        type: 'string',
        required: true,
        schema: {
            enum: ['daily_active', 'weekly_active', 'monthly_active', 'session_count', 'feature_usage'],
        },
    });
    engagementEntity.addProperty({
        info: { name: 'metric_date', displayName: 'Metric Date', description: 'Engagement metric date' },
        type: 'date',
        required: true,
    });
    engagementEntity.addProperty({
        info: { name: 'value', displayName: 'Value', description: 'Engagement metric value' },
        type: 'number',
        required: true,
    });
    addCustomStatusField(engagementEntity, ['tracked', 'analyzed', 'reported'], {
        displayName: 'Engagement Status',
        description: 'Current status of the engagement tracking',
    });
    addCreatedAtField(engagementEntity, { description: 'When the engagement was created' });
    // Retention Entity
    const retentionEntity = analyticsModel.addEntity({
        info: {
            name: 'retention',
            displayName: 'Retention',
            description: 'Player retention analytics',
        },
    });
    addIdField(retentionEntity, { displayName: 'Retention ID', description: 'Unique identifier for the retention' });
    addNameField(retentionEntity, { description: 'Retention name and description' });
    retentionEntity.addProperty({
        info: { name: 'retention_type', displayName: 'Retention Type', description: 'Type of retention' },
        type: 'string',
        required: true,
        schema: {
            enum: ['day_1', 'day_7', 'day_30', 'day_90', 'churn_rate'],
        },
    });
    retentionEntity.addProperty({
        info: { name: 'cohort_date', displayName: 'Cohort Date', description: 'Retention cohort date' },
        type: 'date',
        required: true,
    });
    retentionEntity.addProperty({
        info: { name: 'rate', displayName: 'Rate', description: 'Retention rate percentage' },
        type: 'number',
        required: true,
        schema: {
            minimum: 0,
            maximum: 100,
        },
    });
    addCustomStatusField(retentionEntity, ['tracked', 'analyzed', 'reported'], {
        displayName: 'Retention Status',
        description: 'Current status of the retention tracking',
    });
    addCreatedAtField(retentionEntity, { description: 'When the retention was created' });
    //
    // 6. SOCIAL FEATURES NAMESPACE
    //
    const socialFeatures = domain.addNamespace({
        info: {
            name: 'SocialFeatures',
            displayName: 'Social Features',
            description: 'Friends, chat, and leaderboards',
        },
    });
    // Social Model
    const socialModel = socialFeatures.addModel({
        info: {
            name: 'Social',
            displayName: 'Social Features Management',
            description: 'Social gaming features',
        },
    });
    // Friend Entity
    const friendEntity = socialModel.addEntity({
        info: {
            name: 'friend',
            displayName: 'Friend',
            description: 'Player friendship relationship',
        },
    });
    addIdField(friendEntity, { displayName: 'Friend ID', description: 'Unique identifier for the friend relationship' });
    addNameField(friendEntity, { description: 'Friend relationship name' });
    friendEntity.addProperty({
        info: { name: 'friend_type', displayName: 'Friend Type', description: 'Type of friendship' },
        type: 'string',
        required: true,
        schema: {
            enum: ['mutual', 'pending', 'blocked', 'favorite'],
        },
    });
    friendEntity.addProperty({
        info: { name: 'friend_date', displayName: 'Friend Date', description: 'Friendship start date' },
        type: 'date',
        required: true,
    });
    addCustomStatusField(friendEntity, ['active', 'inactive', 'blocked'], {
        displayName: 'Friend Status',
        description: 'Current status of the friendship',
    });
    addCreatedAtField(friendEntity, { description: 'When the friendship was created' });
    // Friend-Player Association (Many-to-Many)
    friendEntity.addAssociation({ key: playerEntity.key }, {
        info: { name: 'players', displayName: 'Players', description: 'Players in this friendship' },
        required: true,
        multiple: true,
    });
    // Chat Message Entity
    const chatMessageEntity = socialModel.addEntity({
        info: {
            name: 'chat_message',
            displayName: 'Chat Message',
            description: 'Player chat message',
        },
    });
    addIdField(chatMessageEntity, {
        displayName: 'Message ID',
        description: 'Unique identifier for the chat message',
    });
    addNameField(chatMessageEntity, { description: 'Message name and description' });
    addDescriptionField(chatMessageEntity, { description: 'Message content' });
    chatMessageEntity.addProperty({
        info: { name: 'message_type', displayName: 'Message Type', description: 'Type of message' },
        type: 'string',
        required: true,
        schema: {
            enum: ['text', 'voice', 'image', 'system', 'notification'],
        },
    });
    chatMessageEntity.addProperty({
        info: { name: 'channel', displayName: 'Channel', description: 'Chat channel' },
        type: 'string',
        required: true,
    });
    chatMessageEntity.addProperty({
        info: { name: 'sent_time', displayName: 'Sent Time', description: 'Message sent time' },
        type: 'datetime',
        required: true,
    });
    addCustomStatusField(chatMessageEntity, ['sent', 'delivered', 'read', 'deleted'], {
        displayName: 'Message Status',
        description: 'Current status of the message',
    });
    addCreatedAtField(chatMessageEntity, { description: 'When the message was created' });
    // ChatMessage-Player Association (Many-to-One)
    chatMessageEntity.addAssociation({ key: playerEntity.key }, {
        info: { name: 'sender', displayName: 'Sender', description: 'Message sender' },
        required: true,
        multiple: false,
    });
    // Leaderboard Entity
    const leaderboardEntity = socialModel.addEntity({
        info: {
            name: 'leaderboard',
            displayName: 'Leaderboard',
            description: 'Game leaderboard',
        },
    });
    addIdField(leaderboardEntity, {
        displayName: 'Leaderboard ID',
        description: 'Unique identifier for the leaderboard',
    });
    addNameField(leaderboardEntity, { description: 'Leaderboard name and title' });
    addDescriptionField(leaderboardEntity, { description: 'Leaderboard description and criteria' });
    leaderboardEntity.addProperty({
        info: { name: 'leaderboard_type', displayName: 'Leaderboard Type', description: 'Type of leaderboard' },
        type: 'string',
        required: true,
        schema: {
            enum: ['score', 'time', 'achievements', 'wins', 'level', 'custom'],
        },
    });
    leaderboardEntity.addProperty({
        info: { name: 'time_period', displayName: 'Time Period', description: 'Leaderboard time period' },
        type: 'string',
        required: true,
        schema: {
            enum: ['daily', 'weekly', 'monthly', 'all_time', 'season'],
        },
    });
    leaderboardEntity.addProperty({
        info: { name: 'max_entries', displayName: 'Max Entries', description: 'Maximum leaderboard entries' },
        type: 'number',
        required: true,
        schema: {
            minimum: 1,
        },
    });
    addCustomStatusField(leaderboardEntity, ['active', 'inactive', 'archived'], {
        displayName: 'Leaderboard Status',
        description: 'Current status of the leaderboard',
    });
    addCreatedAtField(leaderboardEntity, { description: 'When the leaderboard was created' });
    // LeaderboardEntry Entity
    const leaderboardEntryEntity = socialModel.addEntity({
        info: {
            name: 'leaderboard_entry',
            displayName: 'Leaderboard Entry',
            description: 'Player leaderboard entry',
        },
    });
    addIdField(leaderboardEntryEntity, {
        displayName: 'Entry ID',
        description: 'Unique identifier for the leaderboard entry',
    });
    addNameField(leaderboardEntryEntity, { description: 'Entry name and description' });
    leaderboardEntryEntity.addProperty({
        info: { name: 'rank', displayName: 'Rank', description: 'Entry rank position' },
        type: 'number',
        required: true,
        schema: {
            minimum: 1,
        },
    });
    leaderboardEntryEntity.addProperty({
        info: { name: 'score', displayName: 'Score', description: 'Entry score value' },
        type: 'number',
        required: true,
    });
    leaderboardEntryEntity.addProperty({
        info: { name: 'entry_date', displayName: 'Entry Date', description: 'Entry date' },
        type: 'date',
        required: true,
    });
    addCustomStatusField(leaderboardEntryEntity, ['active', 'archived'], {
        displayName: 'Entry Status',
        description: 'Current status of the leaderboard entry',
    });
    addCreatedAtField(leaderboardEntryEntity, { description: 'When the entry was created' });
    // LeaderboardEntry-Player Association (Many-to-One)
    leaderboardEntryEntity.addAssociation({ key: playerEntity.key }, {
        info: { name: 'player', displayName: 'Player', description: 'Player for this entry' },
        required: true,
        multiple: false,
    });
    // LeaderboardEntry-Leaderboard Association (Many-to-One)
    leaderboardEntryEntity.addAssociation({ key: leaderboardEntity.key }, {
        info: { name: 'leaderboard', displayName: 'Leaderboard', description: 'Leaderboard for this entry' },
        required: true,
        multiple: false,
    });
    return domain;
}
//# sourceMappingURL=gaming-domain.js.map