// WDMainContent.tsx 
import IWDMainContentState from './IWDMainContentState'; 
import IWDMainContentProps from './IWDMainContentProps';
import WDWidgetBase from '@widgets/WDWidgetBase/WDWidgetBase';
import "./WDMainContent.css";
import defaultValue from "./WDMainContentState.json";

export default class WDMainContent extends WDWidgetBase<React.PropsWithChildren<IWDMainContentProps>, IWDMainContentState>{
  
  constructor(props: any) {
    super(props, defaultValue);
    if (this.manualInitState) {
      this.state = {
        ...this.state,
        // Aggiungere qui manualmente la valorizzazione dello stato in base ai valori di props
        header: this.props.header ?? false,
        sidebar: this.props.sidebar ?? false,
        footer: this.props.footer ?? false
      }
    }
  }

  renderContent() {

      let classList = "WDMainContent";
      if (this.state.header && this.state.footer) {
        classList += " HeaderFooter";
      } else if (this.state.header) {
        classList += " Header";
      } else if (this.state.footer) {
        classList += " Footer";
      }
      if (this.state.sidebar) {
        classList += " Sidebar";
      }

       return(
         <div className={classList}>
            {this.props.children}
         </div>
       );
     }
}
