import React from 'react';
import './Window.css';
import type { WindowType } from '../MainApp';

interface WindowProps {
  window: WindowType;
  onClose: (id: string) => void;
  onMinimize: (id: string) => void;
}

const Window: React.FC<WindowProps> = ({ window, onClose, onMinimize }) => {
  return (
    <div className="window">
      <div className="window-header">
        <div className="window-title">
          <span className="window-icon">{window.icon}</span>
          <span>{window.title}</span>
        </div>
        <div className="window-controls">
          <button 
            className="window-btn minimize" 
            onClick={() => onMinimize(window.id)}
            title="Minimize"
          >
            ─
          </button>
          <button 
            className="window-btn close" 
            onClick={() => onClose(window.id)}
            title="Close"
          >
            ✕
          </button>
        </div>
      </div>
      <div className="window-content">
        {window.content}
        {/* <iframe 
          src={window.url} 
          title={window.title}
          className="window-iframe"
          sandbox="allow-same-origin allow-scripts allow-popups allow-forms allow-modals"
        /> */}
      </div>
    </div>
  );
};

export default Window;