import '../domain/governance_status.dart';
import '../domain/policy_check_result.dart';
import '../domain/policy_repository.dart';

/// In-memory fake that returns sample readiness and governance checks
/// derived from Kell Creations products, inventory, and orders.
class FakePolicyRepository implements PolicyRepository {
  @override
  Future<List<PolicyCheckResult>> getPolicyChecks() async {
    await Future<void>.delayed(const Duration(milliseconds: 300));

    final now = DateTime(2026, 4, 4);

    return [
      PolicyCheckResult(
        id: 'POL-001',
        title: 'Product Safety Labeling',
        category: 'Product Compliance',
        status: GovernanceStatus.compliant,
        summary: 'All active products carry required safety labels.',
        detail:
            'Floral Bowl Cozy, Citrus Coaster Set, Ocean Nightlight, Fabric '
            'Jar Gripper, and Skillet Handle Sleeve have been reviewed and '
            'carry the appropriate consumer-safety labels per CPSC guidelines. '
            'Sublimated Slate Coaster is still in draft and will be evaluated '
            'before listing.',
        lastEvaluated: now.subtract(const Duration(days: 2)),
      ),
      PolicyCheckResult(
        id: 'POL-002',
        title: 'Inventory Accuracy Audit',
        category: 'Inventory Governance',
        status: GovernanceStatus.needsReview,
        summary: 'Two SKUs show zero on-hand quantity and need recount.',
        detail:
            'Ocean Nightlight (NL-OCN-003) and Sublimated Slate Coaster '
            '(SC-SUB-006) report zero quantity on hand. A physical recount '
            'should be scheduled to confirm whether stock-outs are accurate '
            'or the result of a data-entry discrepancy.',
        lastEvaluated: now.subtract(const Duration(days: 1)),
      ),
      PolicyCheckResult(
        id: 'POL-003',
        title: 'Order Fulfillment SLA',
        category: 'Order Operations',
        status: GovernanceStatus.compliant,
        summary: 'All orders shipped within the 3-business-day SLA.',
        detail:
            'Review of recent orders (KC-1001 through KC-1006) confirms that '
            'processing-to-ship times remain within the published 3-business-day '
            'service-level agreement. No SLA breaches detected.',
        lastEvaluated: now,
      ),
      PolicyCheckResult(
        id: 'POL-004',
        title: 'Pricing Consistency',
        category: 'Product Compliance',
        status: GovernanceStatus.nonCompliant,
        summary: 'Citrus Coaster Set price differs between store and inventory.',
        detail:
            'The Citrus Coaster Set (CS-CIT-002) is listed at \$16.50 in '
            'inventory but the WordPress storefront shows \$15.99. Prices must '
            'be reconciled before the next sales cycle to avoid consumer '
            'protection issues.',
        lastEvaluated: now,
      ),
      PolicyCheckResult(
        id: 'POL-005',
        title: 'Return & Refund Policy Published',
        category: 'Customer Policy',
        status: GovernanceStatus.compliant,
        summary: 'Return and refund policy is published and up to date.',
        detail:
            'The 30-day return and refund policy is published on the Kell '
            'Creations storefront and was last reviewed on 2026-03-15. No '
            'changes are required at this time.',
        lastEvaluated: now.subtract(const Duration(days: 20)),
      ),
      PolicyCheckResult(
        id: 'POL-006',
        title: 'Low-Stock Reorder Trigger',
        category: 'Inventory Governance',
        status: GovernanceStatus.needsReview,
        summary: 'Two products are below the reorder threshold.',
        detail:
            'Citrus Coaster Set (7 units) and Skillet Handle Sleeve (5 units) '
            'are below the 10-unit reorder point. Purchase orders should be '
            'raised to avoid stock-outs that could delay order fulfillment.',
        lastEvaluated: now.subtract(const Duration(days: 1)),
      ),
      PolicyCheckResult(
        id: 'POL-007',
        title: 'Sales Tax Configuration',
        category: 'Finance & Tax',
        status: GovernanceStatus.notApplicable,
        summary: 'Sales tax collection is not yet enabled.',
        detail:
            'Kell Creations has not yet reached the sales-tax nexus threshold '
            'in any state. This check will become applicable once annual '
            'revenue exceeds the relevant economic-nexus limits.',
        lastEvaluated: now.subtract(const Duration(days: 30)),
      ),
      PolicyCheckResult(
        id: 'POL-008',
        title: 'Cancelled Order Review',
        category: 'Order Operations',
        status: GovernanceStatus.nonCompliant,
        summary: 'A cancelled order lacks a documented reason.',
        detail:
            'Order KC-1006 was cancelled but no cancellation reason was '
            'recorded in the system. Store policy requires a documented reason '
            'for every cancellation to support dispute resolution and trend '
            'analysis.',
        lastEvaluated: now,
      ),
    ];
  }
}
