import { Button, Card, Divider, Space } from "antd";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import PartsBusinessInfoComponent from "./parts-business-info.component";
import PartsLocationsComponent from "./parts-locations.component";
import PartsOrderCommentsComponent from "./parts-order-comments.component";
import PartsEmailPresetsComponent from "./parts-email-presets.component";

const mapStateToProps = createStructuredSelector({});

const mapDispatchToProps = () => ({});

export function PartsShopManagementComponent({ form, saveLoading }) {
  const { t } = useTranslation();

  return (
    <Card
      extra={
        <Button type="primary" loading={saveLoading} onClick={() => form.submit()} id="parts-shop-save-button">
          {t("general.actions.save")}
        </Button>
      }
    >
      <Space orientation="vertical" size="large" style={{ width: "100%" }}>
        {/* Business Information Section - Limited to basic shop info only */}
        <PartsBusinessInfoComponent form={form} />

        <Divider />

        {/* Parts Locations Section */}
        <PartsLocationsComponent form={form} />

        <Divider />

        {/* Parts Orders Comments Section */}
        <PartsOrderCommentsComponent form={form} />

        <Divider />

        {/* Preset To Emails Section - only show if notifications are enabled */}
        <PartsEmailPresetsComponent form={form} />
      </Space>
    </Card>
  );
}

export default connect(mapStateToProps, mapDispatchToProps)(PartsShopManagementComponent);
