import React from 'react';
import { View, ScrollView } from 'react-native';
import { MyText, tw } from 'common-ui';

interface TermsAndConditionsContentProps {
  showTitle?: boolean;
  compact?: boolean;
}

export const TermsAndConditionsContent: React.FC<TermsAndConditionsContentProps> = ({ 
  showTitle = true,
  compact = false 
}) => {
  const textStyle = compact ? tw`text-xs text-gray-600` : tw`text-sm text-gray-600`;
  const headingStyle = compact ? tw`text-sm font-bold text-gray-900` : tw`text-base font-bold text-gray-900`;
  const subheadingStyle = compact ? tw`text-xs font-semibold text-gray-800` : tw`text-sm font-semibold text-gray-800`;

  return (
    <View>
      {showTitle && (
        <>
          <MyText style={headingStyle}>FRESHYO – Legal Policies</MyText>
          <MyText style={tw`text-xs text-gray-500 mb-4`}>Last Updated: [Add Date]</MyText>

          <MyText style={textStyle}>
            By accessing or using the FRESHYO mobile application ("App"), you agree to the following policies. If you do not agree, please do not use the App.
          </MyText>
        </>
      )}

      {/* A. TERMS & CONDITIONS */}
      <MyText weight="bold" style={headingStyle}>A. TERMS & CONDITIONS</MyText>
      
      <MyText weight="semibold" style={subheadingStyle}>1. About FRESHYO</MyText>
      <MyText style={textStyle}>
        FRESHYO is a grocery and fresh meat delivery application serving customers only within Mahabubnagar Town, Telangana, India.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>2. Eligibility</MyText>
      <MyText style={textStyle}>
        Users must be 18 years or older to place orders. By registering, you confirm the accuracy of the information provided.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>3. Service Area</MyText>
      <MyText style={textStyle}>
        Services are limited strictly to Mahabubnagar Town. Orders outside the service area may be cancelled without notice.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>4. Account Registration</MyText>
      <MyText style={textStyle}>
        Registration requires a valid mobile number and OTP verification. Users are responsible for all activity under their account. FRESHYO reserves the right to suspend or terminate accounts for misuse.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>5. Orders</MyText>
      <MyText style={textStyle}>
        Placing an order constitutes an offer to purchase. FRESHYO may accept or reject orders based on availability, pricing errors, or operational reasons.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>6. Pricing & Payment</MyText>
      <MyText style={textStyle}>
        Prices are displayed in INR and include applicable taxes unless stated otherwise. Only Cash on Delivery (COD) is accepted. Full payment must be made at the time of delivery. Failure to pay may result in order cancellation and account restrictions.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>7. Delivery</MyText>
      <MyText style={textStyle}>
        Delivery timelines are estimates and may vary. Users must ensure availability at the delivery address. Incorrect address or unavailability may lead to cancellation.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>8. Fresh Meat & Perishables</MyText>
      <MyText style={textStyle}>
        Fresh meat and perishable items are non-returnable and non-refundable except for: wrong item delivered, spoiled or damaged item at delivery. Issues must be reported within 2 hours with photos.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>9. User Conduct</MyText>
      <MyText style={textStyle}>
        Users must not: provide false information, abuse staff, misuse the App, or engage in illegal activity. Violations may result in permanent account termination.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>10. Intellectual Property</MyText>
      <MyText style={textStyle}>
        All content, branding, and app design belong exclusively to FRESHYO.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>11. Limitation of Liability</MyText>
      <MyText style={textStyle}>
        Liability is limited to the value of the order placed. Product images are indicative only.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>12. Force Majeure</MyText>
      <MyText style={textStyle}>
        FRESHYO is not liable for delays caused by events beyond reasonable control.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>13. Governing Law</MyText>
      <MyText style={textStyle}>
        Governed by Indian law. Jurisdiction: Courts of Telangana.
      </MyText>

      {/* B. PRIVACY POLICY */}
      <MyText weight="bold" style={headingStyle}>B. PRIVACY POLICY</MyText>
      <MyText style={textStyle}>
        FRESHYO respects your privacy and is committed to protecting your data.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>1. Information We Collect</MyText>
      <MyText style={textStyle}>
        Name, mobile number, delivery address, order history, app usage data (basic analytics).
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>2. How We Use Information</MyText>
      <MyText style={textStyle}>
        To process and deliver orders, to communicate order updates, to improve app experience, for customer support.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>3. Data Sharing</MyText>
      <MyText style={textStyle}>
        Data is shared only with delivery partners for order fulfillment. We do not sell or rent personal data to third parties.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>4. Data Security</MyText>
      <MyText style={textStyle}>
        We use reasonable security measures to protect your data. However, no system is 100% secure.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>5. Data Retention</MyText>
      <MyText style={textStyle}>
        Data is retained only as long as necessary for business and legal purposes.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>6. User Rights</MyText>
      <MyText style={textStyle}>
        Users may request: data correction, account deletion (subject to legal and operational requirements).
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>7. Children's Privacy</MyText>
      <MyText style={textStyle}>
        FRESHYO does not knowingly collect data from users under 18.
      </MyText>

      {/* C. REFUND & CANCELLATION POLICY */}
      <MyText weight="bold" style={headingStyle}>C. REFUND & CANCELLATION POLICY</MyText>

      <MyText weight="semibold" style={subheadingStyle}>1. Order Cancellation</MyText>
      <MyText style={textStyle}>
        Orders can be cancelled before dispatch. Once dispatched, cancellation may not be allowed, especially for perishables.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>2. Refund Policy</MyText>
      <MyText style={textStyle}>
        Since payments are Cash on Delivery, refunds (if applicable) will be handled via: cash adjustment, replacement, or store credit (at FRESHYO's discretion).
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>3. Non-Refundable Items</MyText>
      <MyText style={textStyle}>
        Fresh meat and perishable groceries except in cases of damage, spoilage, or wrong delivery.
      </MyText>

      <MyText weight="semibold" style={subheadingStyle}>4. Reporting Issues</MyText>
      <MyText style={textStyle}>
        Issues must be reported within 2 hours of delivery. Supporting photos are mandatory.
      </MyText>

      {/* D. CONTACT INFORMATION */}
      <MyText weight="bold" style={headingStyle}>D. CONTACT INFORMATION</MyText>
      <MyText style={textStyle}>📧 Email: support@freshyo.in</MyText>
      <MyText style={textStyle}>📞 Customer Support: 8688182552</MyText>

      {/* E. ACCEPTANCE */}
      <MyText weight="bold" style={headingStyle}>E. ACCEPTANCE</MyText>
      <MyText style={textStyle}>
        By registering or placing an order, you confirm that you have read, understood, and agreed to all policies above.
      </MyText>
    </View>
  );
};

export default TermsAndConditionsContent;
