import { LegalPage, Section, LegalContact } from "@/components/marketing/legal"
import { LEGAL } from "@/lib/legal"

export const metadata = {
  title: "Terms of Service",
  description: `The terms and conditions that govern your access to and use of the ${LEGAL.service} platform.`,
  alternates: { canonical: "/terms" },
}

export default function Page() {
  return (
    <LegalPage
      title="Terms of Service"
      subtitle={`These Terms of Service govern your access to and use of the ${LEGAL.service} platform. Please read them carefully, because they form a binding agreement between you and ${LEGAL.entity}.`}
    >
      <Section heading="1. Agreement to these Terms">
        <p>
          These Terms of Service (the <strong>Terms</strong>) form a legally binding agreement between you and{" "}
          {LEGAL.entity} (<strong>we</strong>, <strong>us</strong>, or <strong>our</strong>) and govern your access
          to and use of the {LEGAL.service} platform, together with all related websites, applications, features,
          and services (collectively, the <strong>Service</strong>). By creating an account, accessing, or using the
          Service, you agree to be bound by these Terms. If you do not agree, you must not access or use the Service.
        </p>
        <p>
          You represent that you are at least 18 years of age (or the age of legal majority in your jurisdiction) and
          are capable of forming a binding contract. If you use the Service on behalf of a company, organization, or
          other legal entity, you represent and warrant that you have the authority to bind that entity to these
          Terms, and in that case <strong>you</strong> and <strong>Customer</strong> refer to that entity.
        </p>
        <p>
          Throughout these Terms, <strong>you</strong> or <strong>Customer</strong> means the account holder (a
          landlord or property manager); <strong>Tenant</strong> means an end user whose data the Customer manages;
          and <strong>Customer Content</strong> means the data the Customer enters into or uploads to the Service.
        </p>
      </Section>

      <Section heading="2. Description of the Service">
        <p>
          The Service is a software-as-a-service platform that helps landlords and property managers manage rental
          properties, including features for organizing properties and units, tracking tenancies and leases,
          recording payments and expenses, storing documents, sending notifications, generating AI-assisted
          insights, and sharing information with Tenants through a token-based Tenant portal.
        </p>
        <p>
          We may add, modify, or discontinue features of the Service from time to time. The Service is provided as an
          online tool and is not a substitute for professional legal, financial, tax, accounting, or
          property-management advice.
        </p>
      </Section>

      <Section heading="3. Accounts and registration">
        <p>
          To use most features of the Service, you must create an account. You agree to provide accurate, current,
          and complete information during registration and to keep that information up to date. You may register
          using an email address and password or, where offered, through optional Google sign-in.
        </p>
        <p>
          You are responsible for safeguarding your account credentials and for restricting access to your account.
          You must keep your password confidential and notify us promptly at{" "}
          <a href={`mailto:${LEGAL.securityEmail}`}>{LEGAL.securityEmail}</a> if you suspect any unauthorized use of
          your account. You are responsible for all activity that occurs under your account, whether or not
          authorized by you, to the extent permitted by applicable law.
        </p>
      </Section>

      <Section heading="4. Subscriptions, plans, and billing">
        <p>
          The Service is offered under several plans: <strong>Starter</strong> (free), <strong>Pro</strong> ($29 per
          month), <strong>Landlord</strong> ($59 per month), and <strong>Lifetime</strong> ($199 as a one-time
          charge). The features and limits associated with each plan are described on our pricing page and may be
          updated from time to time.
        </p>
        <p>
          Paid subscriptions are billed in advance through our payment processor, <strong>Stripe</strong>. By
          providing a payment method, you authorize us and Stripe to charge the applicable fees, together with any
          applicable taxes, to that payment method. Monthly subscriptions renew automatically at the end of each
          billing cycle until cancelled. You are responsible for all taxes, duties, and similar charges associated
          with your use of the Service, other than taxes based on our net income.
        </p>
        <p>
          We may change our fees or introduce new charges. If we increase the fees for a plan you are subscribed to,
          we will provide prior notice, and the change will take effect on your next billing cycle. Your continued
          use of the Service after a price change takes effect constitutes acceptance of the new fees. Cancellations
          and refunds are governed by our <a href="/refund-policy">Refund &amp; Cancellation Policy</a>.
        </p>
      </Section>

      <Section heading="5. Customer Content and responsibilities">
        <p>
          As between you and us, you retain all rights in and ownership of your <strong>Customer Content</strong>. You
          grant us a limited, non-exclusive, worldwide license to host, store, process, transmit, display, and
          otherwise use the Customer Content solely as necessary to provide, secure, and improve the Service and to
          comply with your instructions and applicable law.
        </p>
        <p>
          You are solely responsible for the accuracy, quality, and legality of your Customer Content and for the
          means by which you acquired it. Where you enter or upload personal data relating to a{" "}
          <strong>Tenant</strong> or any other individual, you represent and warrant that you have a lawful basis and,
          where required, the necessary consent to do so, and that your use of the Service complies with all
          applicable data-protection, housing, and landlord-tenant laws.
        </p>
        <p>
          For personal data that you process through the Service, you act as the <strong>data controller</strong> and
          we act as your processor. Our respective obligations are set out in our{" "}
          <a href="/dpa">Data Processing Addendum</a>, and our general data practices are described in our{" "}
          <a href="/privacy">Privacy Policy</a>.
        </p>
      </Section>

      <Section heading="6. Acceptable use">
        <p>
          Your use of the Service must comply with our <a href="/acceptable-use">Acceptable Use Policy</a>, which is
          incorporated into these Terms by reference. Among other things, you must not use the Service for any
          unlawful purpose, to violate housing, fair-housing, anti-discrimination, or landlord-tenant laws, to harass
          Tenants, or to compromise the security or integrity of the Service. A violation of the Acceptable Use Policy
          is a violation of these Terms.
        </p>
      </Section>

      <Section heading="7. Tenant portal">
        <p>
          The Service includes a token-based <strong>Tenant portal</strong> that allows you to share selected
          information with a Tenant through a secure link. You control what information is shared and with whom, and
          you are responsible for distributing token links only to the intended recipients and for revoking access
          when it is no longer appropriate. We are not responsible for information disclosed as a result of your
          sharing decisions or your handling of token links.
        </p>
      </Section>

      <Section heading="8. Intellectual property">
        <p>
          The Service, including all software, designs, text, graphics, and other materials that we provide (but
          excluding Customer Content), is owned by us or our licensors and is protected by intellectual-property
          laws. Subject to your compliance with these Terms, we grant you a limited, revocable, non-exclusive,
          non-transferable license to access and use the Service for your internal business purposes during the term
          of your subscription. All rights not expressly granted are reserved.
        </p>
        <p>
          If you choose to provide us with suggestions, ideas, or other feedback about the Service, you grant us a
          perpetual, irrevocable, worldwide, royalty-free license to use and incorporate that feedback into the
          Service without any obligation or compensation to you.
        </p>
      </Section>

      <Section heading="9. Third-party services">
        <p>
          The Service relies on and integrates with third-party services, including <strong>Stripe</strong> for
          payments, <strong>OpenAI</strong> for AI features, <strong>SMTP2GO</strong> for email delivery,{" "}
          <strong>DigitalOcean</strong> for hosting and storage, and optional <strong>Google</strong> sign-in. Your
          use of those services may be subject to their own terms and policies. We do not control and are not
          responsible for third-party services, and we make no warranties regarding them. A current list of the
          third parties that process personal data on our behalf is available on our{" "}
          <a href="/subprocessors">Sub-processors</a> page.
        </p>
      </Section>

      <Section heading="10. AI features">
        <p>
          Certain features of the Service use artificial-intelligence models (provided by OpenAI) to generate
          insights, summaries, and suggestions. <strong>AI-generated outputs may be inaccurate, incomplete, or
          otherwise unreliable, are provided for informational purposes only, and do not constitute legal, financial,
          tax, or professional advice.</strong> You are responsible for reviewing and independently verifying any
          AI-generated output before relying on it. Please review our <a href="/disclaimer">Disclaimer</a> for
          further information.
        </p>
      </Section>

      <Section heading="11. Privacy">
        <p>
          Our collection and use of personal information in connection with the Service is described in our{" "}
          <a href="/privacy">Privacy Policy</a>. By using the Service, you acknowledge that you have read and
          understood our Privacy Policy.
        </p>
      </Section>

      <Section heading="12. Suspension and termination">
        <p>
          You may cancel your subscription or close your account at any time as described in our{" "}
          <a href="/refund-policy">Refund &amp; Cancellation Policy</a>. We may suspend or terminate your access to
          the Service, in whole or in part, if you breach these Terms, if your use poses a security, legal, or
          operational risk, if required by law, or if you fail to pay fees when due.
        </p>
        <p>
          Upon termination, your right to access and use the Service ceases. For a period of{" "}
          {LEGAL.dataDeletionDays} days following termination, and where technically feasible, you may request an
          export of your Customer Content, after which we may delete or de-identify it in accordance with our{" "}
          <a href="/privacy">Privacy Policy</a> and <a href="/dpa">Data Processing Addendum</a>. Provisions that by
          their nature should survive termination will survive.
        </p>
      </Section>

      <Section heading="13. Disclaimer of warranties">
        <p>
          <strong>
            THE SERVICE IS PROVIDED ON AN &ldquo;AS IS&rdquo; AND &ldquo;AS AVAILABLE&rdquo; BASIS, WITHOUT
            WARRANTIES OF ANY KIND, WHETHER EXPRESS, IMPLIED, OR STATUTORY.
          </strong>{" "}
          To the maximum extent permitted by applicable law, we disclaim all warranties, including any implied
          warranties of merchantability, fitness for a particular purpose, title, and non-infringement, and any
          warranties arising out of course of dealing or usage of trade.
        </p>
        <p>
          <strong>
            We do not warrant that the Service will be uninterrupted, secure, error-free, or free of harmful
            components, or that any AI-generated output or other results obtained through the Service will be accurate
            or reliable.
          </strong>{" "}
          Some jurisdictions do not allow the exclusion of certain warranties, so some of the above exclusions may not
          apply to you.
        </p>
      </Section>

      <Section heading="14. Limitation of liability">
        <p>
          <strong>
            TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL WE BE LIABLE FOR ANY INDIRECT,
            INCIDENTAL, SPECIAL, CONSEQUENTIAL, EXEMPLARY, OR PUNITIVE DAMAGES, OR FOR ANY LOSS OF PROFITS, REVENUE,
            DATA, GOODWILL, OR BUSINESS OPPORTUNITIES, ARISING OUT OF OR RELATING TO THESE TERMS OR THE SERVICE,
            WHETHER BASED ON CONTRACT, TORT, OR ANY OTHER LEGAL THEORY, EVEN IF WE HAVE BEEN ADVISED OF THE
            POSSIBILITY OF SUCH DAMAGES.
          </strong>
        </p>
        <p>
          <strong>
            OUR TOTAL AGGREGATE LIABILITY ARISING OUT OF OR RELATING TO THESE TERMS OR THE SERVICE WILL NOT EXCEED THE
            GREATER OF (A) THE TOTAL FEES YOU PAID TO US FOR THE SERVICE IN THE TWELVE (12) MONTHS IMMEDIATELY
            PRECEDING THE EVENT GIVING RISE TO THE CLAIM, OR (B) ONE HUNDRED U.S. DOLLARS (USD 100).
          </strong>{" "}
          Some jurisdictions do not allow the limitation or exclusion of liability for certain damages, so some of the
          above limitations may not apply to you.
        </p>
      </Section>

      <Section heading="15. Indemnification">
        <p>
          You agree to defend, indemnify, and hold harmless {LEGAL.entity} and its officers, directors, employees,
          and agents from and against any claims, liabilities, damages, losses, and expenses (including reasonable
          legal fees) arising out of or relating to: (a) your Customer Content; (b) your use of the Service; (c) your
          violation of these Terms or applicable law; and (d) any claim brought by a Tenant or other third party
          arising out of your use of the Service or your handling of their data.
        </p>
      </Section>

      <Section heading="16. Changes to the Service and to these Terms">
        <p>
          We may modify, update, or discontinue the Service or any part of it at any time. We may also revise these
          Terms from time to time. When we make material changes, we will provide notice by reasonable means, such as
          by posting the updated Terms with a new effective date or by notifying you through the Service or by email.
          Your continued use of the Service after the changes take effect constitutes acceptance of the revised
          Terms.
        </p>
      </Section>

      <Section heading="17. Governing law and dispute resolution">
        <p>
          These Terms and any dispute arising out of or relating to them or the Service are governed by the laws of{" "}
          {LEGAL.governingLaw}, without regard to its conflict-of-laws principles. Subject to the arbitration
          provision below, the parties submit to the exclusive jurisdiction and venue of {LEGAL.forum}.
        </p>
        <p>
          <strong>Informal resolution.</strong> Before initiating any formal proceeding, you agree to first contact
          us at <a href={`mailto:${LEGAL.legalEmail}`}>{LEGAL.legalEmail}</a> and to attempt in good faith to resolve
          the dispute informally. Most concerns can be resolved this way.
        </p>
        <p>
          <strong>Binding arbitration and class-action waiver.</strong> To the fullest extent permitted by applicable
          law, any dispute that is not resolved informally will be settled by final and binding arbitration on an
          individual basis, rather than in court, except that either party may bring an individual claim in
          small-claims court. <strong>YOU AND WE EACH WAIVE ANY RIGHT TO A JURY TRIAL AND TO PARTICIPATE IN A CLASS,
          COLLECTIVE, OR REPRESENTATIVE ACTION.</strong> Arbitration will be conducted by a recognized arbitration
          body under its applicable rules, and judgment on the award may be entered in any court of competent
          jurisdiction.
        </p>
        <p>
          Nothing in this section limits any statutory rights that cannot be waived under the law that applies to you.
          Consumers in certain jurisdictions may have non-waivable rights to bring claims in their local courts or
          before their local authorities, and this section does not override those rights.
        </p>
      </Section>

      <Section heading="18. Miscellaneous">
        <p>
          These Terms, together with the policies incorporated by reference (including the{" "}
          <a href="/acceptable-use">Acceptable Use Policy</a>, <a href="/privacy">Privacy Policy</a>,{" "}
          <a href="/dpa">Data Processing Addendum</a>, and <a href="/refund-policy">Refund &amp; Cancellation
          Policy</a>), constitute the entire agreement between you and us regarding the Service and supersede all
          prior agreements on that subject.
        </p>
        <p>
          If any provision of these Terms is held to be invalid or unenforceable, that provision will be limited or
          eliminated to the minimum extent necessary, and the remaining provisions will remain in full force and
          effect. You may not assign or transfer these Terms without our prior written consent; we may assign these
          Terms in connection with a merger, acquisition, or sale of assets. Our failure to enforce any provision is
          not a waiver of our right to do so later.
        </p>
        <p>
          We will not be liable for any failure or delay in performance caused by events beyond our reasonable
          control, including acts of God, natural disasters, outages, or the failure of third-party services (a{" "}
          <strong>force majeure</strong> event). Notices to you may be given through the Service or by email to the
          address associated with your account; notices to us must be sent to{" "}
          <a href={`mailto:${LEGAL.legalEmail}`}>{LEGAL.legalEmail}</a>.
        </p>
      </Section>

      <LegalContact email={LEGAL.legalEmail} />
    </LegalPage>
  )
}
