// TermsContent.jsx: Terms of Service for Skardi Cloud and skardi.ai.
//
// Several clauses describe how the product actually behaves, so keep them in
// step with skardi-cloud when it changes:
//   - §3 workspace-level visibility: CORPORA_ARE_WORKSPACE_SCOPED in
//     skardi-source-contract's registry (every member reads every synced corpus);
//   - §3 read-only connectors: the oauth_install_scopes in that registry;
//   - §8 early access: signupPolicy `code` and the quotas in skardi-global's profile;
//   - §9 fees: billing.mode (off in prod as of this writing; no free tier planned);
//   - §10 deletion: the workspace deregistration design (hard delete, audit_log
//     kept) and the RBAC backup retention in the skardi-cloud chart (48 hourly).
// Governing law, venue, liability cap and contact were chosen by SkardiLabs on
// 2026-10-13. This text has not yet been reviewed by counsel.
const TERMS_UPDATED = 'October 13, 2026';

const TERMS_SECTIONS = [
  {
    id: 'eligibility', title: 'Who can use Skardi Cloud',
    body: <>
      <LP>You must be at least 18 years old, or the age of majority where you live if that is higher, and able to enter into a binding contract. Skardi Cloud is built for work. If you use it for an organization, you confirm that you are authorized to accept these Terms for that organization, and "you" includes it.</LP>
      <LP>Skardi Cloud is in early access and admission is by invitation. Signup codes and invitations are for the person they were issued to and may not be sold or shared publicly.</LP>
      <LP>Give us accurate account information and keep it current. You are responsible for keeping your sign-in credentials safe and for everything done with them, including by the personal access tokens, agent tokens and signed-in command-line sessions you create. Tell us at <LLink href="mailto:info@skardi.ai">info@skardi.ai</LLink> straight away if you think any of them has been compromised, and revoke it in the console.</LP>
    </>,
  },
  {
    id: 'workspaces', title: 'Organizations, workspaces and members',
    body: <>
      <LP>An <LStrong>organization</LStrong> is the account that holds one or more <LStrong>workspaces</LStrong>. Each person who signs up also gets a personal workspace. Organization admins control their organization: they can connect and remove sources, invite and remove members, change roles, and delete workspaces. If you join a workspace that someone else administers, its admins can see what you do in it, change your access, or remove you.</LP>
      <LP>The organization that owns a workspace is responsible for the people it lets in and for how they use it. When a member is removed, their access to that workspace ends, but content they connected to it stays with the workspace until an admin removes it.</LP>
    </>,
  },
  {
    id: 'sources', title: 'Connecting your sources',
    body: <>
      <LP>Skardi Cloud reads from the services you connect to it (for example Gmail, Google Drive, GitHub, Notion, Slack and databases) using the credentials or authorizations you give it. You authorize us to access, copy, index and store content from each connected source to provide the service to the workspace you connected it to. Our connectors only read. They do not create, change or delete anything in your sources.</LP>
      <LP>You may connect only sources you are entitled to connect, and only within the terms of the service that hosts them and any obligations you have to your employer, your customers or other people whose information they hold. Those third-party services are not part of Skardi Cloud and their own terms apply. If a provider changes or withdraws its API, we may have to change or remove the connector.</LP>
      <LP><LStrong>Content connected to a workspace is shared with that workspace.</LStrong> Skardi applies a source's own permissions where it can evaluate them at query time, but content synced from a source is readable by every member of the workspace it is connected to, including items the source itself would not let a particular member open. Connect a source only to a workspace whose members may see all of it. You remain responsible for the permission settings in your sources.</LP>
      <LP>You can disconnect a source at any time, which stops further access and deletes what was indexed from it. You can also revoke our access from the provider's own settings.</LP>
    </>,
  },
  {
    id: 'agents', title: 'Your agents and AI output',
    body: <>
      <LP>Skardi Cloud serves context to the AI agents and tools you connect to it, such as Claude Code, Codex, Cursor or Gemini CLI. Those agents are not ours. You choose which agents to connect, what credentials and permissions to give them, and how much they may do without you. You are responsible for what they do with the context they receive and for the actions they take.</LP>
      <LP>Content in your sources can contain instructions written to manipulate an AI agent (prompt injection). Skardi passes content through as it is and cannot detect every such attempt, so supervise agents that act on their own and limit what they can reach.</LP>
      <LP>Some features use AI to generate text, such as the daily brief. AI output can be incomplete or wrong. Check it before you rely on it, and do not use Skardi Cloud or its output as the sole basis for decisions with legal, financial, medical or similarly significant effects on a person.</LP>
    </>,
  },
  {
    id: 'customer-data', title: 'Your data',
    body: <>
      <LP>"<LStrong>Customer Data</LStrong>" means the content we receive from your connected sources and uploads, the queries you and your agents send, and the results we return. As between you and us, you own Customer Data.</LP>
      <LP>You grant us a worldwide, non-exclusive license to host, copy, index, process, transmit and display Customer Data only as needed to provide, secure and support Skardi Cloud for you, and as described in our <LLink href="/privacy">Privacy Policy</LLink>. This license ends when the data is deleted.</LP>
      <LUL>
        <LLI>We do not use Customer Data to train or improve AI or machine-learning models, and we do not sell it.</LLI>
        <LLI>Information we receive from Google APIs is used in line with the Google API Services User Data Policy, including its Limited Use requirements.</LLI>
        <LLI>Skardi personnel access Customer Data only when needed to provide, secure or support the service, to investigate abuse, or when the law requires it.</LLI>
        <LLI>We share Customer Data with the subprocessors listed on our <LLink href="/subprocessors">Subprocessors</LLink> page, only to run the service.</LLI>
      </LUL>
      <LP>We may collect information about how Skardi Cloud is used (usage information, described in the Privacy Policy) and create aggregated or de-identified data from it, which we may use to operate and improve the service. It will not identify you, your organization or your content.</LP>
      <LP>If you send us feedback or suggestions, we may use them without obligation to you.</LP>
    </>,
  },
  {
    id: 'acceptable-use', title: 'Acceptable use',
    body: <>
      <LP>Your use of Skardi Cloud must follow our <LLink href="/acceptable-use">Acceptable Use Policy</LLink>, which is part of these Terms. In addition, you may not:</LP>
      <LUL>
        <LLI>resell, sublicense or provide Skardi Cloud to third parties as a service, except to the members of your own organization;</LLI>
        <LLI>copy, modify, reverse engineer or decompile the hosted service, except to the extent the law allows despite this restriction;</LLI>
        <LLI>use the service, or information about it that is not public, to build a competing product;</LLI>
        <LLI>remove or obscure any proprietary notices.</LLI>
      </LUL>
    </>,
  },
  {
    id: 'ip', title: 'Our service and intellectual property',
    body: <>
      <LP>We and our licensors own Skardi Cloud, including the console, the services behind it, the documentation, and the Skardi name and logos. Subject to these Terms, we give you a limited, non-exclusive, non-transferable right to use Skardi Cloud for your internal purposes while your account is active.</LP>
      <LP>The open-source Skardi engine and the <LCode>skardi</LCode> command-line tool are published under the Apache License 2.0, and your use of that software is governed by that license. These Terms apply when you use them with Skardi Cloud.</LP>
    </>,
  },
  {
    id: 'early-access', title: 'Early access, changes and limits',
    body: <>
      <LP>Skardi Cloud is an early-access service under active development. We may add, change or remove features, including connectors, and some features may be labeled as previews. We do not currently offer a service level agreement or uptime commitment. We will try to give notice before removing a feature you rely on.</LP>
      <LP>Workspaces are subject to limits, such as the number of sources and connections, upload sizes and request rates. We may set or change these limits to keep the service reliable for everyone.</LP>
    </>,
  },
  {
    id: 'fees', title: 'Fees',
    body: <>
      <LP>We do not charge for Skardi Cloud during early access unless you have agreed to pay in an order form or other written agreement with us. Before we start charging for an account, we will tell the account's organization admins and give them the chance to stop using the service first.</LP>
      <LP>When you subscribe to a paid plan, fees are billed in advance through our payment processor for each billing period and renew automatically until you cancel. A cancellation takes effect at the end of the current billing period. Fees are exclusive of taxes and, except where the law requires otherwise, are non-refundable. If a payment fails and is not resolved, we may pause the account's access after notice.</LP>
    </>,
  },
  {
    id: 'termination', title: 'Suspension, termination and deletion',
    body: <>
      <LP>You can stop using Skardi Cloud at any time. Organization admins can delete a workspace from the console. Deletion is permanent and cannot be undone.</LP>
      <LP>We may suspend or restrict access to an account, a workspace or a credential if we reasonably believe it breaches these Terms or the Acceptable Use Policy, puts the service or other customers at risk, or must be suspended to comply with the law. Where we can, we will tell you first and give you a chance to fix the problem. We may also end these Terms for convenience with 30 days' notice.</LP>
      <LP>When a workspace is deleted, we promptly delete its configuration, the content indexed from its sources, and its query and sync logs. We keep an audit trail of account and membership events, and the identifiers needed to read it, for security and compliance. Some operational backups of workspace metadata can hold copies for up to 48 hours before they are overwritten. To have your account and the rest of what we hold about you deleted, email <LLink href="mailto:info@skardi.ai">info@skardi.ai</LLink> and we will act on it within 30 days.</LP>
      <LP>Because our connectors only read, your sources remain the system of record. Keep your own copies of anything you upload directly. Sections 5, 7, 12 to 15 and 17, and any fees already owed, survive the end of these Terms.</LP>
    </>,
  },
  {
    id: 'security', title: 'Security',
    body: <>
      <LP>We use reasonable technical and organizational measures to protect Customer Data, including encryption in transit and at rest, encrypted storage of source credentials, and a separate runtime for each workspace. No system is perfectly secure. If we become aware of a security incident that affects your Customer Data, we will notify the affected organization's admins without undue delay.</LP>
      <LP>If you find a vulnerability, report it to <LLink href="mailto:info@skardi.ai">info@skardi.ai</LLink>. The Acceptable Use Policy explains what good-faith testing is allowed.</LP>
    </>,
  },
  {
    id: 'disclaimers', title: 'Disclaimers',
    body: <>
      <LP>Skardi Cloud, its output and any preview features are provided "as is" and "as available". To the fullest extent the law allows, we disclaim all warranties, whether express, implied or statutory, including warranties of merchantability, fitness for a particular purpose, title and non-infringement, and any warranty that the service will be uninterrupted, error-free or secure, or that AI output will be accurate.</LP>
    </>,
  },
  {
    id: 'liability', title: 'Limitation of liability',
    body: <>
      <LP>To the fullest extent the law allows, neither SkardiLabs nor its suppliers will be liable for any indirect, incidental, special, consequential or punitive damages, or for lost profits, revenue, goodwill or data, arising out of or relating to these Terms or Skardi Cloud, even if advised of the possibility.</LP>
      <LP>To the fullest extent the law allows, our total liability for all claims arising out of or relating to these Terms or Skardi Cloud is limited to the greater of the fees you paid us for Skardi Cloud in the 12 months before the event giving rise to the claim, and US$100.</LP>
    </>,
  },
  {
    id: 'indemnity', title: 'Indemnification',
    body: <>
      <LP>You will defend and indemnify SkardiLabs and its personnel against third-party claims, and the resulting losses and reasonable costs, arising from Customer Data you connect or upload, your connection of a source you were not entitled to connect, the actions of agents you connect to Skardi Cloud, or your breach of these Terms or the Acceptable Use Policy. We will tell you promptly about any such claim and let you control its defense, though you may not settle a claim that imposes obligations on us without our consent.</LP>
    </>,
  },
  {
    id: 'law', title: 'Governing law and disputes',
    body: <>
      <LP>These Terms are governed by the laws of the State of Delaware, without regard to its conflict-of-laws rules. Any dispute arising out of or relating to these Terms or Skardi Cloud will be brought exclusively in the state or federal courts located in the State of Delaware, and both parties consent to their jurisdiction. Either party may seek injunctive relief in any court to protect its intellectual property or confidential information.</LP>
    </>,
  },
  {
    id: 'changes', title: 'Changes to these Terms',
    body: <>
      <LP>We may update these Terms. We will change the date at the top, and for a material change we will notify organization admins by email or in the console at least 30 days before it takes effect, unless the change is required sooner by law or to address a security risk. If you keep using Skardi Cloud after a change takes effect, the updated Terms apply. If you do not agree, stop using the service before then.</LP>
    </>,
  },
  {
    id: 'general', title: 'General',
    body: <>
      <LUL>
        <LLI><LStrong>Export and sanctions.</LStrong> You may not use Skardi Cloud in breach of US export controls or sanctions, or from a country or for a person they prohibit.</LLI>
        <LLI><LStrong>Entire agreement.</LStrong> These Terms, the Acceptable Use Policy and the Privacy Policy are the whole agreement about Skardi Cloud. If you have signed a separate agreement with us that covers Skardi Cloud, it takes precedence where the two conflict.</LLI>
        <LLI><LStrong>Assignment.</LStrong> You may not transfer these Terms without our consent. We may transfer them to an affiliate or in connection with a merger, acquisition or sale of assets.</LLI>
        <LLI><LStrong>Force majeure.</LStrong> Neither party is liable for delays or failures caused by events beyond its reasonable control, other than payment obligations.</LLI>
        <LLI><LStrong>Severability and waiver.</LStrong> If a provision is unenforceable, the rest remains in effect. Not enforcing a provision is not a waiver of it.</LLI>
        <LLI><LStrong>Notices.</LStrong> We send notices to the email address on your account or in the console. Send notices to us at <LLink href="mailto:info@skardi.ai">info@skardi.ai</LLink>.</LLI>
        <LLI><LStrong>Relationship.</LStrong> The parties are independent contractors. Nothing here creates a partnership, agency or employment relationship.</LLI>
      </LUL>
      <LP>Questions about these Terms? Email <LLink href="mailto:info@skardi.ai">info@skardi.ai</LLink>.</LP>
    </>,
  },
];

const TermsContent = () => (
  <LegalLayout
    page="terms"
    title="Terms of Service"
    updated={TERMS_UPDATED}
    intro={<>
      <LP>These Terms of Service govern your use of <LStrong>Skardi Cloud</LStrong>: the console at console.skardi.ai, the APIs and agent connections behind it, and the <LCode>skardi</LCode> command-line tool when it is signed in to Skardi Cloud. They also cover this website, skardi.ai. They are an agreement between you and <LStrong>SkardiLabs, Inc.</LStrong> ("SkardiLabs", "we", "us").</LP>
      <LP>By creating an account, accepting an invitation or using Skardi Cloud, you agree to these Terms. If you do not agree, do not use it.</LP>
    </>}
    summary={[
      'You own your data. We use it only to run Skardi Cloud for you, and never to train AI models.',
      'Connect only sources you have the right to connect. Everything connected to a workspace can be read by every member of that workspace.',
      'The agents you connect are yours to supervise, and AI output can be wrong.',
      'Skardi Cloud is in early access: no charge unless agreed in writing, no uptime commitment, and features may change.',
      'Deleting a workspace is permanent. Delaware law applies.',
    ]}
    sections={TERMS_SECTIONS}
  />
);

window.TermsContent = TermsContent;
