'use client';

import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/Card';
import { TrendingUp, TrendingDown, DollarSign } from 'lucide-react';

export function CostForecastingTile() {
  // Mock data - in production, this would come from API
  const forecast = {
    currentMonth: 45230,
    nextMonth: 48500,
    threeMonths: 52000,
    sixMonths: 58000,
    trend: 'up',
    confidence: 85,
  };

  const TrendIcon = forecast.trend === 'up' ? TrendingUp : TrendingDown;
  const trendColor = forecast.trend === 'up' ? 'text-red-400' : 'text-green-400';

  return (
    <Card className="bg-gray-800 border-gray-700">
      <CardHeader>
        <CardTitle className="text-white flex items-center gap-2">
          <DollarSign className="h-5 w-5 text-orange-500" />
          Cost Forecasting
        </CardTitle>
      </CardHeader>
      <CardContent>
        <div className="space-y-4">
          <div>
            <p className="text-sm text-gray-400 mb-1">Current Month</p>
            <p className="text-2xl font-bold text-white">
              ${forecast.currentMonth.toLocaleString()}
            </p>
          </div>

          <div className="space-y-3">
            <div className="p-3 bg-gray-900 rounded-lg">
              <div className="flex items-center justify-between mb-1">
                <span className="text-sm text-gray-400">Next Month</span>
                <div className="flex items-center gap-1">
                  <TrendIcon className={`h-4 w-4 ${trendColor}`} />
                  <span className={`text-sm font-semibold ${trendColor}`}>
                    {((forecast.nextMonth - forecast.currentMonth) / forecast.currentMonth * 100).toFixed(1)}%
                  </span>
                </div>
              </div>
              <p className="text-lg font-semibold text-white">
                ${forecast.nextMonth.toLocaleString()}
              </p>
            </div>

            <div className="p-3 bg-gray-900 rounded-lg">
              <div className="flex items-center justify-between mb-1">
                <span className="text-sm text-gray-400">3 Months</span>
                <span className="text-sm text-gray-400">{forecast.confidence}% confidence</span>
              </div>
              <p className="text-lg font-semibold text-white">
                ${forecast.threeMonths.toLocaleString()}
              </p>
            </div>

            <div className="p-3 bg-gray-900 rounded-lg">
              <div className="flex items-center justify-between mb-1">
                <span className="text-sm text-gray-400">6 Months</span>
                <span className="text-sm text-gray-400">{forecast.confidence}% confidence</span>
              </div>
              <p className="text-lg font-semibold text-white">
                ${forecast.sixMonths.toLocaleString()}
              </p>
            </div>
          </div>

          <div className="pt-2 border-t border-gray-700">
            <p className="text-xs text-gray-400">
              Forecast based on historical usage patterns and trends
            </p>
          </div>
        </div>
      </CardContent>
    </Card>
  );
}

