from django.core.management.base import BaseCommand
from case_studies.models import CaseStudyCategory, Client, CaseStudy, CaseStudyProcess
from django.utils import timezone
from datetime import timedelta


class Command(BaseCommand):
    help = 'Populate database with sample enterprise case study data with Unsplash images'

    def handle(self, *args, **options):
        self.stdout.write(self.style.SUCCESS('Starting to populate enterprise case study data...'))

        # Clear existing data
        CaseStudyProcess.objects.all().delete()
        CaseStudy.objects.all().delete()
        Client.objects.all().delete()
        CaseStudyCategory.objects.all().delete()

        # Create Enterprise Categories
        categories_data = [
            {
                'name': 'Enterprise Software',
                'slug': 'enterprise-software',
                'description': 'Large-scale enterprise software solutions and digital transformation projects',
                'display_order': 1
            },
            {
                'name': 'Cloud Migration',
                'slug': 'cloud-migration',
                'description': 'Cloud infrastructure migration and modernization projects',
                'display_order': 2
            },
            {
                'name': 'AI & Machine Learning',
                'slug': 'ai-machine-learning',
                'description': 'Artificial intelligence and machine learning implementations',
                'display_order': 3
            },
            {
                'name': 'System Integration',
                'slug': 'system-integration',
                'description': 'Enterprise system integration and API development projects',
                'display_order': 4
            },
            {
                'name': 'Data Analytics',
                'slug': 'data-analytics',
                'description': 'Business intelligence and data analytics solutions',
                'display_order': 5
            },
            {
                'name': 'Digital Transformation',
                'slug': 'digital-transformation',
                'description': 'End-to-end digital transformation initiatives',
                'display_order': 6
            }
        ]

        categories = {}
        for cat_data in categories_data:
            category = CaseStudyCategory.objects.create(**cat_data)
            categories[category.slug] = category
            self.stdout.write(f'Created category: {category.name}')

        # Create Enterprise Clients
        clients_data = [
            {
                'name': 'Undisclosed Client',
                'slug': 'undisclosed-client',
                'description': 'Confidential enterprise client',
                'website': '',
                'logo_url': 'https://images.unsplash.com/photo-1560179707-f14e90ef3623?w=200&h=200&fit=crop'
            }
        ]

        clients = {}
        for client_data in clients_data:
            client = Client.objects.create(**client_data)
            clients[client.slug] = client
            self.stdout.write(f'Created client: {client.name}')

        # Create Enterprise Case Studies with Unsplash Images
        case_studies_data = [
            {
                'title': 'Enterprise Telemedicine Application Platform',
                'slug': 'enterprise-telemedicine-application-platform',
                'subtitle': 'Secure Healthcare Delivery with Java and React',
                'excerpt': 'GNX Soft developed a comprehensive telemedicine platform enabling healthcare providers to deliver remote consultations, manage patient records, and facilitate virtual care delivery. Built with Java backend and React frontend, the platform serves thousands of healthcare professionals and patients nationwide.',
                'description': '''
<h2>Executive Summary</h2>
<p>GNX Soft developed a comprehensive telemedicine platform enabling healthcare providers to deliver remote consultations, manage patient records, and facilitate virtual care delivery. Built with Java backend and React frontend, the platform serves thousands of healthcare professionals and patients nationwide, ensuring HIPAA compliance and secure healthcare data management.</p>

<h3>The Challenge</h3>
<p>The client needed a scalable telemedicine solution that could handle high volumes of video consultations, integrate with existing Electronic Health Records (EHR) systems, and maintain strict HIPAA compliance. The platform required real-time video capabilities, secure messaging, prescription management, and comprehensive patient record management.</p>

<h3>Our Solution</h3>
<p>We architected a robust telemedicine platform with the following key features:</p>
<ul>
<li>Real-time video consultation with HD quality and low latency</li>
<li>Secure patient portal with appointment scheduling and medical history access</li>
<li>HIPAA-compliant messaging and file sharing</li>
<li>Electronic prescription management and pharmacy integration</li>
<li>Integration with major EHR systems (Epic, Cerner, Allscripts)</li>
<li>Mobile-responsive design for patients and providers</li>
<li>Advanced analytics and reporting dashboard</li>
<li>Multi-tenant architecture supporting multiple healthcare organizations</li>
</ul>

<h3>Key Results</h3>
<ul>
<li>99.9% platform uptime ensuring reliable healthcare delivery</li>
<li>Support for 50,000+ monthly consultations</li>
<li>HIPAA and HITECH compliance certification</li>
<li>60% reduction in no-show rates through automated reminders</li>
<li>Average consultation setup time under 30 seconds</li>
<li>95% patient satisfaction score</li>
<li>Seamless integration with 15+ EHR systems</li>
</ul>

<h2>Technology Stack</h2>
<p>Java (Spring Boot), React, WebRTC, PostgreSQL, Redis, RabbitMQ, Docker, Kubernetes, AWS, HIPAA-compliant infrastructure</p>
                ''',
                'category': categories['enterprise-software'],
                'client': clients['undisclosed-client'],
                'thumbnail_url': 'https://images.unsplash.com/photo-1576091160550-2173dba999ef?w=800&h=600&fit=crop',
                'featured_image_url': 'https://images.unsplash.com/photo-1576091160550-2173dba999ef?w=1920&h=1080&fit=crop',
                'poster_image_url': 'https://images.unsplash.com/photo-1559757148-5c350d0d3c56?w=1920&h=1080&fit=crop',
                'project_image_url': 'https://images.unsplash.com/photo-1559757148-5c350d0d3c56?w=1200&h=800&fit=crop',
                'project_overview': '''
                <p>GNX Soft developed a comprehensive telemedicine platform that revolutionizes remote healthcare delivery. Built with Java Spring Boot backend and React frontend, the solution enables healthcare providers to conduct secure video consultations, manage patient records, and deliver virtual care services while maintaining strict HIPAA compliance.</p>
                <p>The platform features real-time video capabilities, secure messaging, prescription management, and seamless integration with major EHR systems. With support for thousands of concurrent consultations and multi-tenant architecture, the solution serves multiple healthcare organizations while ensuring data security and regulatory compliance.</p>
                ''',
                'site_map_content': '''
                <h3>Platform Architecture</h3>
                <p>The telemedicine platform follows a modern microservices architecture:</p>
                <ul>
                <li><strong>Frontend Layer:</strong> React-based responsive web application with real-time video capabilities</li>
                <li><strong>API Gateway:</strong> Java Spring Boot RESTful APIs with authentication and authorization</li>
                <li><strong>Video Service:</strong> WebRTC-based real-time video consultation engine</li>
                <li><strong>Patient Management:</strong> Comprehensive patient record and appointment management system</li>
                <li><strong>EHR Integration:</strong> Secure integration layer for connecting with external EHR systems</li>
                <li><strong>Messaging Service:</strong> HIPAA-compliant secure messaging and file sharing</li>
                <li><strong>Prescription Management:</strong> Electronic prescription generation and pharmacy integration</li>
                <li><strong>Analytics Dashboard:</strong> Real-time analytics and reporting for healthcare administrators</li>
                </ul>
                ''',
                'meta_description': 'Enterprise telemedicine platform case study: Java and React solution for secure remote healthcare delivery.',
                'meta_keywords': 'telemedicine, healthcare software, Java, React, HIPAA, remote consultations, EHR integration',
                'featured': True,
                'published': True,
                'display_order': 1,
                'days_ago': 5
            },
            {
                'title': 'Enterprise Hotel Booking Platform',
                'slug': 'enterprise-hotel-booking-platform',
                'subtitle': 'Scalable Hospitality Management with FastAPI and Angular',
                'excerpt': 'GNX Soft developed a comprehensive hotel booking and management platform that enables hotels to manage reservations, inventory, pricing, and guest services. Built with FastAPI backend and Angular frontend, the platform processes millions of bookings annually across thousands of properties worldwide.',
                'description': '''
<h2>Executive Summary</h2>
<p>GNX Soft developed a comprehensive hotel booking and management platform that enables hotels to manage reservations, inventory, pricing, and guest services. Built with FastAPI backend and Angular frontend, the platform processes millions of bookings annually across thousands of properties worldwide, providing real-time availability, dynamic pricing, and seamless payment processing.</p>

<h3>The Challenge</h3>
<p>The client required a high-performance booking platform capable of handling peak traffic during seasonal periods, managing complex inventory across multiple properties, implementing dynamic pricing strategies, and integrating with various payment gateways and third-party booking channels. The solution needed to support real-time availability updates, prevent overbooking, and provide comprehensive reporting and analytics.</p>

<h3>Our Solution</h3>
<p>We built a scalable hotel booking platform with the following capabilities:</p>
<ul>
<li>Real-time room availability and inventory management</li>
<li>Dynamic pricing engine with rule-based and AI-driven pricing strategies</li>
<li>Multi-property management with centralized administration</li>
<li>Channel manager integration (Booking.com, Expedia, Airbnb)</li>
<li>Secure payment processing with multiple gateway support</li>
<li>Guest management system with loyalty program integration</li>
<li>Advanced search and filtering with geolocation support</li>
<li>Mobile-responsive booking interface and admin dashboard</li>
<li>Comprehensive reporting and revenue analytics</li>
<li>API-first architecture for third-party integrations</li>
</ul>

<h3>Key Results</h3>
<ul>
<li>99.95% platform uptime during peak booking seasons</li>
<li>Support for 5,000+ concurrent bookings per minute</li>
<li>30% increase in direct bookings through improved user experience</li>
<li>25% revenue growth through dynamic pricing optimization</li>
<li>Real-time synchronization across all booking channels</li>
<li>Zero overbooking incidents through intelligent inventory management</li>
<li>Average booking completion time under 2 minutes</li>
<li>Integration with 20+ third-party booking channels</li>
</ul>

<h2>Technology Stack</h2>
<p>FastAPI (Python), Angular, PostgreSQL, Redis, Celery, RabbitMQ, Elasticsearch, Docker, Kubernetes, AWS, Stripe, PayPal</p>
                ''',
                'category': categories['enterprise-software'],
                'client': clients['undisclosed-client'],
                'thumbnail_url': 'https://images.unsplash.com/photo-1566073771259-6a8506099945?w=800&h=600&fit=crop',
                'featured_image_url': 'https://images.unsplash.com/photo-1566073771259-6a8506099945?w=1920&h=1080&fit=crop',
                'poster_image_url': 'https://images.unsplash.com/photo-1564501049412-61c2a3083791?w=1920&h=1080&fit=crop',
                'project_image_url': 'https://images.unsplash.com/photo-1564501049412-61c2a3083791?w=1200&h=800&fit=crop',
                'project_overview': '''
                <p>GNX Soft developed a comprehensive hotel booking and management platform that revolutionizes hospitality operations. Built with FastAPI backend and Angular frontend, the solution enables hotels to manage reservations, inventory, pricing, and guest services while processing millions of bookings annually across thousands of properties worldwide.</p>
                <p>The platform features real-time availability management, dynamic pricing strategies, seamless channel manager integration, and comprehensive reporting capabilities. With support for high concurrent traffic and intelligent inventory management, the solution ensures optimal revenue generation while preventing overbooking and maintaining exceptional user experience.</p>
                ''',
                'site_map_content': '''
                <h3>Platform Architecture</h3>
                <p>The hotel booking platform follows a modern microservices architecture:</p>
                <ul>
                <li><strong>Frontend Layer:</strong> Angular-based responsive web application with progressive web app capabilities</li>
                <li><strong>API Layer:</strong> FastAPI RESTful APIs with async processing and high performance</li>
                <li><strong>Booking Engine:</strong> Real-time availability checking and reservation management</li>
                <li><strong>Pricing Engine:</strong> Dynamic pricing algorithms with rule-based and AI-driven strategies</li>
                <li><strong>Channel Manager:</strong> Integration layer for synchronizing with third-party booking channels</li>
                <li><strong>Payment Gateway:</strong> Secure payment processing with multiple provider support</li>
                <li><strong>Inventory Management:</strong> Real-time room inventory tracking and allocation</li>
                <li><strong>Analytics Dashboard:</strong> Comprehensive reporting and revenue management tools</li>
                </ul>
                ''',
                'meta_description': 'Enterprise hotel booking platform case study: FastAPI and Angular solution for scalable hospitality management.',
                'meta_keywords': 'hotel booking, hospitality software, FastAPI, Angular, channel manager, dynamic pricing, booking engine',
                'featured': True,
                'published': True,
                'display_order': 2,
                'days_ago': 12
            },
            {
                'title': 'Enterprise POS System with National Revenue Integration',
                'slug': 'enterprise-pos-system-national-revenue-integration',
                'subtitle': 'Comprehensive Retail Management with External System Integration',
                'excerpt': 'GNX Soft developed an enterprise Point of Sale (POS) system integrated with national revenue authorities and multiple external systems. The solution handles millions of transactions daily across thousands of retail locations, ensuring compliance with tax regulations and seamless integration with payment processors, inventory systems, and government reporting platforms.',
                'description': '''
<h2>Executive Summary</h2>
<p>GNX Soft developed an enterprise Point of Sale (POS) system integrated with national revenue authorities and multiple external systems. The solution handles millions of transactions daily across thousands of retail locations, ensuring compliance with tax regulations and seamless integration with payment processors, inventory systems, and government reporting platforms.</p>

<h3>The Challenge</h3>
<p>The client required a robust POS system that could integrate with national revenue authority systems for real-time tax reporting, connect with multiple payment gateways, synchronize with inventory management systems, and provide comprehensive reporting capabilities. The solution needed to handle high transaction volumes, ensure data security, maintain compliance with tax regulations, and support offline operations during network outages.</p>

<h3>Our Solution</h3>
<p>We built a comprehensive enterprise POS platform featuring:</p>
<ul>
<li>Real-time transaction processing with offline capability</li>
<li>National revenue authority integration for automatic tax reporting</li>
<li>Multi-payment gateway support (credit cards, mobile payments, cash)</li>
<li>Inventory management with real-time stock synchronization</li>
<li>Customer relationship management (CRM) integration</li>
<li>Loyalty program and rewards management</li>
<li>Comprehensive sales reporting and analytics</li>
<li>Multi-store and multi-location support</li>
<li>Employee management and shift tracking</li>
<li>Receipt printing and digital receipt delivery</li>
<li>Barcode scanning and product lookup</li>
<li>Secure payment processing with PCI-DSS compliance</li>
</ul>

<h3>Key Results</h3>
<ul>
<li>99.9% system uptime with offline transaction support</li>
<li>Processing of 10+ million transactions monthly</li>
<li>100% compliance with national tax reporting requirements</li>
<li>Real-time integration with national revenue authority systems</li>
<li>50% reduction in manual tax reporting time</li>
<li>Seamless integration with 15+ external systems</li>
<li>30% improvement in transaction processing speed</li>
<li>Zero data loss during network outages</li>
<li>Comprehensive audit trail for all transactions</li>
</ul>

<h2>Technology Stack</h2>
<p>Java (Spring Boot), React, PostgreSQL, Redis, RabbitMQ, REST APIs, SOAP, Docker, Kubernetes, AWS, Payment Gateway APIs, National Revenue Authority APIs</p>
                ''',
                'category': categories['system-integration'],
                'client': clients['undisclosed-client'],
                'thumbnail_url': 'https://images.unsplash.com/photo-1556742049-0cfed4f6a45d?w=800&h=600&fit=crop',
                'featured_image_url': 'https://images.unsplash.com/photo-1556742049-0cfed4f6a45d?w=1920&h=1080&fit=crop',
                'poster_image_url': 'https://images.unsplash.com/photo-1556740758-90de374c12ad?w=1920&h=1080&fit=crop',
                'project_image_url': 'https://images.unsplash.com/photo-1556740758-90de374c12ad?w=1200&h=800&fit=crop',
                'project_overview': '''
                <p>GNX Soft developed an enterprise Point of Sale (POS) system that revolutionizes retail operations through seamless integration with national revenue authorities and multiple external systems. The solution processes millions of transactions daily across thousands of retail locations, ensuring real-time tax compliance, secure payment processing, and comprehensive business intelligence.</p>
                <p>Our platform features robust offline capabilities, ensuring business continuity during network outages. The system integrates with payment processors, inventory management systems, customer relationship management platforms, and government reporting systems, providing a unified solution for modern retail operations.</p>
                ''',
                'site_map_content': '''
                <h3>System Architecture</h3>
                <p>The enterprise POS system follows a distributed architecture with comprehensive integration capabilities:</p>
                <ul>
                <li><strong>POS Terminal:</strong> React-based touchscreen interface for transaction processing</li>
                <li><strong>Backend Services:</strong> Java Spring Boot microservices for business logic and data processing</li>
                <li><strong>Payment Gateway Integration:</strong> Secure integration with multiple payment processors</li>
                <li><strong>National Revenue Authority:</strong> Real-time tax reporting and compliance integration</li>
                <li><strong>Inventory System:</strong> Real-time stock synchronization and product management</li>
                <li><strong>CRM Integration:</strong> Customer data synchronization and loyalty program management</li>
                <li><strong>Reporting Engine:</strong> Comprehensive analytics and business intelligence</li>
                <li><strong>Offline Mode:</strong> Local transaction storage with automatic synchronization</li>
                </ul>
                ''',
                'meta_description': 'Enterprise POS system case study: National revenue integration with external systems for retail management.',
                'meta_keywords': 'POS system, point of sale, retail software, tax integration, payment processing, enterprise software',
                'featured': True,
                'published': True,
                'display_order': 3,
                'days_ago': 20
            },
            {
                'title': 'Enterprise Cloud Infrastructure Migration',
                'slug': 'enterprise-cloud-infrastructure-migration',
                'subtitle': 'Large-Scale Digital Transformation Initiative',
                'excerpt': 'GNX Soft executed a comprehensive cloud infrastructure migration for a major enterprise, migrating 1000+ applications and services from legacy on-premises infrastructure to a modern cloud-native architecture. The project involved zero-downtime migration strategies, containerization, and complete infrastructure modernization.',
                'description': '''
<h2>Executive Summary</h2>
<p>GNX Soft executed a comprehensive cloud infrastructure migration for a major enterprise, migrating 1000+ applications and services from legacy on-premises infrastructure to a modern cloud-native architecture. The project involved zero-downtime migration strategies, containerization, and complete infrastructure modernization across multiple business units.</p>

<h3>The Challenge</h3>
<p>The client operated a complex legacy infrastructure with thousands of applications running on outdated hardware and software. They needed to modernize their entire IT landscape while maintaining business continuity, ensuring security compliance, and achieving significant cost reductions. The migration required careful planning to avoid service disruptions and ensure seamless transition.</p>

<h3>Our Solution</h3>
<p>We implemented a comprehensive cloud migration strategy including:</p>
<ul>
<li>Complete infrastructure assessment and dependency mapping</li>
<li>Application containerization using Docker and Kubernetes</li>
<li>Microservices architecture transformation</li>
<li>Zero-downtime migration strategies with blue-green deployments</li>
<li>Automated CI/CD pipelines for continuous deployment</li>
<li>Cloud-native monitoring and observability</li>
<li>Security hardening and compliance validation</li>
<li>Disaster recovery and backup solutions</li>
<li>Cost optimization and resource management</li>
<li>Comprehensive staff training and knowledge transfer</li>
</ul>

<h3>Key Results</h3>
<ul>
<li>100% successful migration of 1000+ applications</li>
<li>Zero business disruption during migration</li>
<li>60% reduction in infrastructure costs</li>
<li>99.99% uptime maintained throughout migration</li>
<li>70% improvement in application deployment speed</li>
<li>Complete security and compliance certification</li>
<li>Automated scaling and resource optimization</li>
<li>24/7 monitoring and alerting capabilities</li>
</ul>

<h2>Technology Stack</h2>
<p>Docker, Kubernetes, AWS, Azure, Terraform, Ansible, Jenkins, GitLab CI/CD, Prometheus, Grafana, ELK Stack, CloudWatch</p>
                ''',
                'category': categories['cloud-migration'],
                'client': clients['undisclosed-client'],
                'thumbnail_url': 'https://images.unsplash.com/photo-1451187580459-43490279c0fa?w=800&h=600&fit=crop',
                'featured_image_url': 'https://images.unsplash.com/photo-1451187580459-43490279c0fa?w=1920&h=1080&fit=crop',
                'poster_image_url': 'https://images.unsplash.com/photo-1558494949-ef010cbdcc31?w=1920&h=1080&fit=crop',
                'project_image_url': 'https://images.unsplash.com/photo-1558494949-ef010cbdcc31?w=1200&h=800&fit=crop',
                'project_overview': '''
                <p>GNX Soft executed a comprehensive cloud infrastructure migration that transformed the entire IT landscape of a major enterprise. The project successfully migrated 1000+ applications and services from legacy on-premises infrastructure to a modern cloud-native architecture, achieving zero downtime and significant cost savings.</p>
                <p>Our team implemented containerization strategies, microservices architecture, and automated deployment pipelines to ensure scalability, reliability, and operational efficiency. The migration included comprehensive security hardening, compliance validation, and disaster recovery solutions, ensuring business continuity and regulatory compliance.</p>
                ''',
                'site_map_content': '''
                <h3>Migration Architecture</h3>
                <p>The cloud migration followed a structured, phased approach:</p>
                <ul>
                <li><strong>Assessment Phase:</strong> Comprehensive infrastructure audit, application inventory, and dependency mapping</li>
                <li><strong>Planning Phase:</strong> Migration strategy development, risk assessment, and timeline planning</li>
                <li><strong>Pilot Phase:</strong> Small-scale migration of non-critical applications to validate approach</li>
                <li><strong>Migration Phase:</strong> Systematic migration of all applications using blue-green deployment strategies</li>
                <li><strong>Optimization Phase:</strong> Performance tuning, cost optimization, and continuous improvement</li>
                <li><strong>Operations Phase:</strong> 24/7 monitoring, automated scaling, and ongoing support</li>
                </ul>
                ''',
                'meta_description': 'Enterprise cloud migration case study: Zero-downtime migration of 1000+ applications to cloud-native architecture.',
                'meta_keywords': 'cloud migration, digital transformation, containerization, Kubernetes, microservices, enterprise infrastructure',
                'featured': False,
                'published': True,
                'display_order': 4,
                'days_ago': 30
            },
            {
                'title': 'Enterprise Financial Management System',
                'slug': 'enterprise-financial-management-system',
                'subtitle': 'Comprehensive Financial Operations Platform',
                'excerpt': 'GNX Soft developed an enterprise financial management system that handles complex accounting, financial reporting, budgeting, and compliance requirements for large organizations. The platform integrates with banking systems, payment processors, and regulatory reporting platforms, ensuring real-time financial visibility and compliance.',
                'description': '''
<h2>Executive Summary</h2>
<p>GNX Soft developed an enterprise financial management system that handles complex accounting, financial reporting, budgeting, and compliance requirements for large organizations. The platform integrates with banking systems, payment processors, and regulatory reporting platforms, ensuring real-time financial visibility and compliance with international accounting standards.</p>

<h3>The Challenge</h3>
<p>The client required a comprehensive financial management solution that could handle multi-currency transactions, complex accounting rules, regulatory compliance, and real-time financial reporting. The system needed to integrate with multiple banking systems, support various payment methods, and provide detailed audit trails for compliance purposes.</p>

<h3>Our Solution</h3>
<p>We built a robust financial management platform featuring:</p>
<ul>
<li>General ledger and chart of accounts management</li>
<li>Accounts payable and receivable processing</li>
<li>Multi-currency transaction handling</li>
<li>Financial reporting and analytics dashboards</li>
<li>Budget planning and variance analysis</li>
<li>Bank reconciliation and cash management</li>
<li>Tax calculation and compliance reporting</li>
<li>Integration with banking systems and payment gateways</li>
<li>Audit trail and compliance tracking</li>
<li>Role-based access control and security</li>
<li>Automated workflow approvals</li>
<li>Real-time financial dashboards</li>
</ul>

<h3>Key Results</h3>
<ul>
<li>99.9% system uptime ensuring continuous financial operations</li>
<li>80% reduction in manual financial reporting time</li>
<li>100% compliance with international accounting standards</li>
<li>Real-time financial visibility across all business units</li>
<li>Automated reconciliation reducing errors by 95%</li>
<li>Seamless integration with 20+ banking and payment systems</li>
<li>Comprehensive audit trail for regulatory compliance</li>
<li>Multi-currency support for global operations</li>
</ul>

<h2>Technology Stack</h2>
<p>Java (Spring Boot), React, PostgreSQL, Redis, RabbitMQ, REST APIs, Docker, Kubernetes, AWS, Banking APIs, Payment Gateway APIs</p>
                ''',
                'category': categories['enterprise-software'],
                'client': clients['undisclosed-client'],
                'thumbnail_url': 'https://images.unsplash.com/photo-1551288049-bebda4e38f71?w=800&h=600&fit=crop',
                'featured_image_url': 'https://images.unsplash.com/photo-1551288049-bebda4e38f71?w=1920&h=1080&fit=crop',
                'poster_image_url': 'https://images.unsplash.com/photo-1460925895917-afdab827c52f?w=1920&h=1080&fit=crop',
                'project_image_url': 'https://images.unsplash.com/photo-1460925895917-afdab827c52f?w=1200&h=800&fit=crop',
                'project_overview': '''
                <p>GNX Soft developed an enterprise financial management system that revolutionizes financial operations for large organizations. The platform handles complex accounting, financial reporting, budgeting, and compliance requirements while integrating seamlessly with banking systems, payment processors, and regulatory reporting platforms.</p>
                <p>Our solution provides real-time financial visibility, automated reconciliation, and comprehensive compliance tracking. The system supports multi-currency transactions, complex accounting rules, and provides detailed audit trails, ensuring regulatory compliance and operational efficiency.</p>
                ''',
                'site_map_content': '''
                <h3>System Architecture</h3>
                <p>The financial management system follows a modular architecture:</p>
                <ul>
                <li><strong>Accounting Module:</strong> General ledger, chart of accounts, and transaction processing</li>
                <li><strong>Payables & Receivables:</strong> Invoice management and payment processing</li>
                <li><strong>Financial Reporting:</strong> Real-time reporting and analytics dashboards</li>
                <li><strong>Budget Management:</strong> Budget planning, tracking, and variance analysis</li>
                <li><strong>Banking Integration:</strong> Real-time bank reconciliation and cash management</li>
                <li><strong>Compliance Engine:</strong> Tax calculation and regulatory reporting</li>
                <li><strong>Audit System:</strong> Comprehensive audit trail and compliance tracking</li>
                </ul>
                ''',
                'meta_description': 'Enterprise financial management system: Comprehensive financial operations platform with banking integration.',
                'meta_keywords': 'financial management, accounting software, ERP, financial reporting, compliance, enterprise software',
                'featured': False,
                'published': True,
                'display_order': 5,
                'days_ago': 45
            },
            {
                'title': 'Enterprise Customer Relationship Management Platform',
                'slug': 'enterprise-customer-relationship-management-platform',
                'subtitle': 'Unified Customer Engagement Solution',
                'excerpt': 'GNX Soft developed a comprehensive Customer Relationship Management (CRM) platform that unifies customer data, sales processes, marketing automation, and customer service across all touchpoints. The solution provides 360-degree customer view, predictive analytics, and automated workflows to enhance customer engagement and drive revenue growth.',
                'description': '''
<h2>Executive Summary</h2>
<p>GNX Soft developed a comprehensive Customer Relationship Management (CRM) platform that unifies customer data, sales processes, marketing automation, and customer service across all touchpoints. The solution provides 360-degree customer view, predictive analytics, and automated workflows to enhance customer engagement and drive revenue growth.</p>

<h3>The Challenge</h3>
<p>The client needed a unified CRM solution that could consolidate customer data from multiple sources, automate sales and marketing processes, provide comprehensive analytics, and integrate with various business systems. The platform needed to support large sales teams, handle complex customer journeys, and provide actionable insights for business growth.</p>

<h3>Our Solution</h3>
<p>We built an enterprise CRM platform with comprehensive capabilities:</p>
<ul>
<li>360-degree customer profile with unified data view</li>
<li>Sales pipeline management and opportunity tracking</li>
<li>Marketing automation and campaign management</li>
<li>Customer service ticketing and support management</li>
<li>Lead scoring and qualification automation</li>
<li>Email and communication tracking</li>
<li>Document management and collaboration</li>
<li>Predictive analytics and AI-powered insights</li>
<li>Workflow automation and process management</li>
<li>Integration with email, calendar, and communication tools</li>
<li>Mobile applications for field sales teams</li>
<li>Comprehensive reporting and analytics dashboards</li>
</ul>

<h3>Key Results</h3>
<ul>
<li>40% increase in sales productivity</li>
<li>35% improvement in lead conversion rates</li>
<li>50% reduction in customer response time</li>
<li>Unified view of all customer interactions</li>
<li>Automated workflows reducing manual tasks by 60%</li>
<li>Real-time analytics enabling data-driven decisions</li>
<li>Seamless integration with 30+ business systems</li>
<li>Mobile access enabling field sales effectiveness</li>
</ul>

<h2>Technology Stack</h2>
<p>Python (Django), React, PostgreSQL, Redis, Celery, RabbitMQ, Elasticsearch, Docker, Kubernetes, AWS, Machine Learning APIs</p>
                ''',
                'category': categories['digital-transformation'],
                'client': clients['undisclosed-client'],
                'thumbnail_url': 'https://images.unsplash.com/photo-1551288049-bebda4e38f71?w=800&h=600&fit=crop',
                'featured_image_url': 'https://images.unsplash.com/photo-1551288049-bebda4e38f71?w=1920&h=1080&fit=crop',
                'poster_image_url': 'https://images.unsplash.com/photo-1460925895917-afdab827c52f?w=1920&h=1080&fit=crop',
                'project_image_url': 'https://images.unsplash.com/photo-1460925895917-afdab827c52f?w=1200&h=800&fit=crop',
                'project_overview': '''
                <p>GNX Soft developed a comprehensive Customer Relationship Management (CRM) platform that transforms how organizations engage with customers. The solution unifies customer data, sales processes, marketing automation, and customer service, providing a 360-degree view of customer interactions and enabling data-driven decision making.</p>
                <p>Our platform features predictive analytics, automated workflows, and seamless integrations with business systems. The solution enhances sales productivity, improves lead conversion, and enables personalized customer experiences through AI-powered insights and automation.</p>
                ''',
                'site_map_content': '''
                <h3>Platform Architecture</h3>
                <p>The CRM platform consists of integrated modules:</p>
                <ul>
                <li><strong>Customer Data Hub:</strong> Unified customer profile with data from all touchpoints</li>
                <li><strong>Sales Management:</strong> Pipeline tracking, opportunity management, and sales forecasting</li>
                <li><strong>Marketing Automation:</strong> Campaign management, lead nurturing, and email marketing</li>
                <li><strong>Customer Service:</strong> Ticketing system, knowledge base, and support management</li>
                <li><strong>Analytics Engine:</strong> Predictive analytics, reporting, and business intelligence</li>
                <li><strong>Integration Layer:</strong> Connectors for email, calendar, communication, and business systems</li>
                <li><strong>Mobile Platform:</strong> Native mobile apps for sales and service teams</li>
                </ul>
                ''',
                'meta_description': 'Enterprise CRM platform: Unified customer engagement solution with predictive analytics and automation.',
                'meta_keywords': 'CRM, customer relationship management, sales automation, marketing automation, customer engagement',
                'featured': False,
                'published': True,
                'display_order': 6,
                'days_ago': 60
            }
        ]

        # Process steps templates
        process_templates = [
            [
                {'step_number': 1, 'title': 'Requirements Analysis', 'description': 'Understanding healthcare workflows, HIPAA compliance requirements, and telemedicine needs.'},
                {'step_number': 2, 'title': 'System Design', 'description': 'Designing HIPAA-compliant architecture with Java Spring Boot backend and React frontend.'},
                {'step_number': 3, 'title': 'Core Development', 'description': 'Building video consultation engine, patient portal, and appointment management system.'},
                {'step_number': 4, 'title': 'Integration', 'description': 'Integrating with EHR systems, payment gateways, and pharmacy services.'},
                {'step_number': 5, 'title': 'Testing & Certification', 'description': 'Rigorous testing, HIPAA compliance validation, and production deployment.'}
            ],
            [
                {'step_number': 1, 'title': 'Architecture Design', 'description': 'Designing scalable microservices architecture with FastAPI backend and Angular frontend.'},
                {'step_number': 2, 'title': 'Core Development', 'description': 'Building booking engine, inventory management, and pricing engine.'},
                {'step_number': 3, 'title': 'Integration', 'description': 'Integrating with channel managers, payment gateways, and third-party booking platforms.'},
                {'step_number': 4, 'title': 'Advanced Features', 'description': 'Implementing dynamic pricing, analytics dashboard, and mobile optimization.'},
                {'step_number': 5, 'title': 'Performance Optimization', 'description': 'Optimizing for high traffic, real-time synchronization, and scalability.'}
            ],
            [
                {'step_number': 1, 'title': 'Requirements Gathering', 'description': 'Understanding retail operations, tax compliance requirements, and integration needs.'},
                {'step_number': 2, 'title': 'System Design', 'description': 'Designing POS architecture with Java backend, React frontend, and external system integrations.'},
                {'step_number': 3, 'title': 'Core Development', 'description': 'Building transaction processing, inventory management, and payment processing modules.'},
                {'step_number': 4, 'title': 'External Integration', 'description': 'Integrating with national revenue authority, payment gateways, and inventory systems.'},
                {'step_number': 5, 'title': 'Testing & Deployment', 'description': 'Comprehensive testing, compliance validation, and multi-location deployment.'}
            ],
            [
                {'step_number': 1, 'title': 'Infrastructure Assessment', 'description': 'Comprehensive evaluation of existing infrastructure, applications, and dependencies.'},
                {'step_number': 2, 'title': 'Migration Planning', 'description': 'Detailed migration strategy, containerization plan, and zero-downtime approach.'},
                {'step_number': 3, 'title': 'Containerization', 'description': 'Application containerization using Docker and Kubernetes orchestration setup.'},
                {'step_number': 4, 'title': 'Phased Migration', 'description': 'Systematic migration of applications with blue-green deployment strategies.'},
                {'step_number': 5, 'title': 'Optimization & Operations', 'description': 'Performance tuning, cost optimization, and 24/7 monitoring setup.'}
            ],
            [
                {'step_number': 1, 'title': 'Requirements Analysis', 'description': 'Understanding financial operations, accounting standards, and compliance requirements.'},
                {'step_number': 2, 'title': 'System Design', 'description': 'Designing financial management architecture with Java backend and React frontend.'},
                {'step_number': 3, 'title': 'Core Development', 'description': 'Building accounting modules, financial reporting, and budget management systems.'},
                {'step_number': 4, 'title': 'Integration', 'description': 'Integrating with banking systems, payment processors, and regulatory reporting platforms.'},
                {'step_number': 5, 'title': 'Testing & Compliance', 'description': 'Rigorous testing, compliance validation, and production deployment.'}
            ],
            [
                {'step_number': 1, 'title': 'Requirements Gathering', 'description': 'Understanding customer engagement needs, sales processes, and integration requirements.'},
                {'step_number': 2, 'title': 'System Design', 'description': 'Designing CRM architecture with Python Django backend and React frontend.'},
                {'step_number': 3, 'title': 'Core Development', 'description': 'Building customer data hub, sales pipeline, and marketing automation modules.'},
                {'step_number': 4, 'title': 'Advanced Features', 'description': 'Implementing predictive analytics, workflow automation, and mobile applications.'},
                {'step_number': 5, 'title': 'Integration & Deployment', 'description': 'Integrating with business systems, comprehensive testing, and production rollout.'}
            ]
        ]

        # Create case studies
        created_case_studies = []
        for idx, cs_data in enumerate(case_studies_data):
            days_ago = cs_data.pop('days_ago')
            
            case_study = CaseStudy.objects.create(
                **cs_data,
                published_at=timezone.now() - timedelta(days=days_ago)
            )
            created_case_studies.append(case_study)
            
            # Add process steps
            processes = process_templates[idx % len(process_templates)]
            
            for process_data in processes:
                CaseStudyProcess.objects.create(
                    case_study=case_study,
                    **process_data
                )
            
            self.stdout.write(f'Created case study: {case_study.title}')

        self.stdout.write(self.style.SUCCESS('\nSuccessfully populated enterprise case study data!'))
        self.stdout.write(f'Created {CaseStudyCategory.objects.count()} categories')
        self.stdout.write(f'Created {Client.objects.count()} clients')
        self.stdout.write(f'Created {CaseStudy.objects.count()} case studies')
        self.stdout.write(f'Created {CaseStudyProcess.objects.count()} process steps')
