/**
 * Mock API stubs for frontend development
 * These can be used during parallel development before backend is ready
 */

export const mockResources = [
  {
    id: '1',
    name: 'web-server-01',
    type: 'VM',
    status: 'RUNNING',
    site: {
      id: 'site-1',
      name: 'US East Primary Site',
      region: 'us-east-1',
      status: 'ACTIVE',
    },
    metadata: {
      cpu: 4,
      memory: 8192,
      disk: 100,
    },
    createdAt: new Date().toISOString(),
    updatedAt: new Date().toISOString(),
  },
  {
    id: '2',
    name: 'db-server-01',
    type: 'VM',
    status: 'RUNNING',
    site: {
      id: 'site-1',
      name: 'US East Primary Site',
      region: 'us-east-1',
      status: 'ACTIVE',
    },
    metadata: {
      cpu: 8,
      memory: 16384,
      disk: 500,
    },
    createdAt: new Date().toISOString(),
    updatedAt: new Date().toISOString(),
  },
]

export const mockSites = [
  {
    id: 'site-1',
    name: 'US East Primary Site',
    region: 'us-east-1',
    status: 'ACTIVE',
    resources: mockResources,
    createdAt: new Date().toISOString(),
    updatedAt: new Date().toISOString(),
  },
  {
    id: 'site-2',
    name: 'EU Central Primary Site',
    region: 'eu-central-1',
    status: 'ACTIVE',
    resources: [],
    createdAt: new Date().toISOString(),
    updatedAt: new Date().toISOString(),
  },
]

export const mockResourceInventory = [
  {
    id: 'inv-1',
    resourceType: 'virtual_machine',
    provider: 'PROXMOX',
    providerId: 'vm-101',
    providerResourceId: 'proxmox://cluster1/vm/101',
    name: 'web-server-01',
    region: 'us-east-1',
    site: mockSites[0],
    metadata: {
      cpu: 4,
      memory: 8192,
    },
    tags: ['web', 'production'],
    discoveredAt: new Date().toISOString(),
    lastSyncedAt: new Date().toISOString(),
    createdAt: new Date().toISOString(),
    updatedAt: new Date().toISOString(),
  },
]

export const mockMetrics = {
  resource: mockResourceInventory[0],
  metricType: 'CPU_USAGE',
  values: Array.from({ length: 60 }, (_, i) => ({
    timestamp: new Date(Date.now() - (60 - i) * 60000).toISOString(),
    value: Math.random() * 100,
    labels: {},
  })),
  timeRange: {
    start: new Date(Date.now() - 3600000).toISOString(),
    end: new Date().toISOString(),
  },
}

export const mockPillars = [
  { id: '1', code: 'SECURITY', name: 'Security', description: 'Security pillar' },
  { id: '2', code: 'RELIABILITY', name: 'Reliability', description: 'Reliability pillar' },
  { id: '3', code: 'COST_OPTIMIZATION', name: 'Cost Optimization', description: 'Cost pillar' },
  { id: '4', code: 'PERFORMANCE_EFFICIENCY', name: 'Performance Efficiency', description: 'Performance pillar' },
  { id: '5', code: 'OPERATIONAL_EXCELLENCE', name: 'Operational Excellence', description: 'Operations pillar' },
  { id: '6', code: 'SUSTAINABILITY', name: 'Sustainability', description: 'Sustainability pillar' },
]

export const mockFindings = [
  {
    id: 'f1',
    control: {
      id: 'c1',
      code: 'SEC-001',
      name: 'Encryption at Rest',
      pillar: mockPillars[0],
    },
    resource: mockResourceInventory[0],
    status: 'PASS',
    severity: 'LOW',
    title: 'Encryption enabled',
    description: 'All storage is encrypted',
    recommendation: null,
    createdAt: new Date().toISOString(),
    updatedAt: new Date().toISOString(),
  },
]

export const mockRegions = [
  {
    id: 'r1',
    name: 'US East',
    code: 'us-east-1',
    country: 'United States',
    coordinates: { latitude: 39.8283, longitude: -98.5795 },
    sites: [mockSites[0]],
    createdAt: new Date().toISOString(),
    updatedAt: new Date().toISOString(),
    metadata: {},
  },
]

/**
 * Mock GraphQL query responses
 */
export const mockGraphQLResponses = {
  resources: () => ({ data: { resources: mockResources } }),
  sites: () => ({ data: { sites: mockSites } }),
  resourceInventory: () => ({ data: { resourceInventory: mockResourceInventory } }),
  metrics: () => ({ data: { metrics: mockMetrics } }),
  pillars: () => ({ data: { pillars: mockPillars } }),
  findings: () => ({ data: { findings: mockFindings } }),
  regions: () => ({ data: { regions: mockRegions } }),
}

