/* bloo.app — Plain-language license and update policy for the AI Code Review System. */
(function () {
const { PRODUCT, LINKS, Icons, S } = window.Site;
const { useT } = window.I18n;
const { IconArrow } = Icons;

const LicenseS = {
  prose: { maxWidth: 720, margin: '0 auto', display: 'flex', flexDirection: 'column', gap: 28 },
  block: { display: 'flex', flexDirection: 'column', gap: 10 },
  body: { fontSize: 15.5, lineHeight: 1.65, color: 'var(--text-body)', margin: 0 },
  backRow: { marginTop: 8 },
};

function Section({ eyebrow, title, children, sunken }) {
  return (
    <section style={sunken
      ? { ...S.section, background: 'var(--surface-sunken)', borderTop: '1px solid var(--border-subtle)', borderBottom: '1px solid var(--border-subtle)' }
      : S.section
    }>
      <div style={S.container} className="site-container">
        <div style={S.sectionHead}>
          {eyebrow && <span style={S.eyebrow}>{eyebrow}</span>}
          <h2 style={S.h2} className={eyebrow ? 'site-h1' : undefined}>{title}</h2>
        </div>
        <div style={LicenseS.prose}>{children}</div>
      </div>
    </section>
  );
}

function Block({ heading, children }) {
  return (
    <div style={LicenseS.block}>
      <h3 style={S.h3}>{heading}</h3>
      {children}
    </div>
  );
}

function LicenseIntro() {
  const { t } = useT();
  return (
    <Section
      eyebrow={t('LICENSE & UPDATES', 'LICENÇA E ATUALIZAÇÕES')}
      title={t('Plain-language license and update policy.', 'Licença e política de atualizações em linguagem clara.')}
    >
      <p style={LicenseS.body}>
        {t(
          'This page explains what you get when you buy the bloo AI Code Review System: permanent use of the purchased version, the team boundary, what you may and may not do with the files, how updates and support work, refunds, and privacy.',
          'Esta página explica o que você recebe ao comprar o bloo AI Code Review System: uso permanente da versão adquirida, o limite do time, o que pode e não pode fazer com os arquivos, como funcionam atualizações e suporte, reembolsos e privacidade.'
        )}
      </p>
      <p style={LicenseS.body}>
        {t(
          'It is written for buyers in plain language. It is not a substitute for formal legal advice; confirm details with counsel if your organization requires it.',
          'Está escrita para compradores em linguagem clara. Não substitui assessoria jurídica formal; confirme os detalhes com assessoria se sua organização exigir.'
        )}
      </p>
      <p style={{ ...LicenseS.body, color: 'var(--text-subtle)', fontSize: 13.5 }}>
        {t(`Effective July 2026. The current product version is ${PRODUCT.version} (${PRODUCT.stageLabel.en.toLowerCase()}). bloo may update this policy; material changes are noted in the changelog.`, `Em vigor desde julho de 2026. A versão atual do produto é ${PRODUCT.version} (${PRODUCT.stageLabel.pt.toLowerCase()}). A bloo pode atualizar esta política; mudanças materiais são anotadas no changelog.`)}
      </p>
      <div style={LicenseS.backRow}>
        <a href="product-ai-code-review.html" style={S.cardLink}>
          <span style={{ display: 'inline-flex', transform: 'scaleX(-1)' }}><IconArrow size={16} /></span>
          {t('Back to AI Code Review System', 'Voltar ao AI Code Review System')}
        </a>
      </div>
    </Section>
  );
}

function WhatYouGet() {
  const { t } = useT();
  return (
    <Section
      sunken
      title={t('What the purchase covers', 'O que a compra cobre')}
    >
      <Block heading={t('Permanent use of the purchased version', 'Uso permanente da versão adquirida')}>
        <p style={LicenseS.body}>
          {t(
            'Your team may use the version of the system you purchased permanently. Paying once buys ongoing rights to that version — not a rental that expires when the update plan ends.',
            'Seu time pode usar permanentemente a versão do sistema que comprou. Um pagamento compra direitos contínuos a essa versão — não um aluguel que acaba quando o plano de atualizações termina.'
          )}
        </p>
      </Block>
      <Block heading={t('Team boundary', 'Limite do time')}>
        <p style={LicenseS.body}>
          {t(
            `One license covers one company or engineering team of up to ${PRODUCT.teamSize} developers. That is the licensed team for the purchase.`,
            `Uma licença cobre uma empresa ou time de engenharia de até ${PRODUCT.teamSize} desenvolvedores. Esse é o time licenciado da compra.`
          )}
        </p>
      </Block>
      <Block heading={t('Internal modification', 'Modificação interna')}>
        <p style={LicenseS.body}>
          {t(
            'You may modify the files for your own internal use — for example, team-specific conventions, routing, or review rules — so the system fits how you work.',
            'Você pode modificar os arquivos para uso interno — por exemplo, convenções do time, roteamento ou regras de revisão — para o sistema se adequar à forma como vocês trabalham.'
          )}
        </p>
      </Block>
      <Block heading={t('No redistribution', 'Sem redistribuição')}>
        <p style={LicenseS.body}>
          {t(
            'You may not redistribute, resell, sublicense, or publicly share the commercial package (or a substantial derivative of it). Keep it inside the licensed team.',
            'Você não pode redistribuir, revender, sublicenciar ou compartilhar publicamente o pacote comercial (nem um derivado substancial dele). Mantenha-o dentro do time licenciado.'
          )}
        </p>
      </Block>
      <Block heading={t('Contractors', 'Contratados')}>
        <p style={LicenseS.body}>
          {t(
            'Contractors may use the system only on projects for the licensed team. They may not take the package to other clients or unrelated work.',
            'Contratados podem usar o sistema somente em projetos do time licenciado. Não podem levar o pacote para outros clientes ou trabalhos não relacionados.'
          )}
        </p>
      </Block>
      <Block heading={t('Affiliated entities', 'Entidades afiliadas')}>
        <p style={LicenseS.body}>
          {t(
            `One license covers one team of up to ${PRODUCT.teamSize} developers. Separate subsidiaries, sister teams, or headcount beyond that need their own license — contact Bruno about multi-team terms.`,
            `Uma licença cobre um time de até ${PRODUCT.teamSize} desenvolvedores. Subsidiárias separadas, times irmãos ou headcount acima disso precisam da própria licença — fale com Bruno sobre termos para múltiplos times.`
          )}
        </p>
      </Block>
    </Section>
  );
}

function UpdatesAndSupport() {
  const { t } = useT();
  return (
    <Section title={t('Updates and support', 'Atualizações e suporte')}>
      <Block heading={t(`First ${PRODUCT.includedUpdateMonths} months included`, `Primeiros ${PRODUCT.includedUpdateMonths} meses inclusos`)}>
        <p style={LicenseS.body}>
          {t(
            `The purchase includes ${PRODUCT.includedUpdateMonths} months of updates and support from the purchase date. That covers new releases, compatibility updates, improvements, documentation updates, and support for installation and adoption.`,
            `A compra inclui ${PRODUCT.includedUpdateMonths} meses de atualizações e suporte a partir da data da compra. Isso cobre novos releases, atualizações de compatibilidade, melhorias, atualizações de documentação e suporte para instalação e adoção.`
          )}
        </p>
      </Block>
      <Block heading={t('Optional Updates and Support Plan', 'Plano opcional de atualizações e suporte')}>
        <p style={LicenseS.body}>
          {t(
            `After the included year, you may renew the optional Updates and Support Plan for $${PRODUCT.optionalUpdatesUsd}/year. Renewal continues new releases, tool-compatibility updates, benchmark improvements, new adapters, documentation updates, and support.`,
            `Depois do ano incluso, você pode renovar o plano opcional de atualizações e suporte por US$ ${PRODUCT.optionalUpdatesUsd}/ano. A renovação continua novos releases, atualizações de compatibilidade com ferramentas, melhorias de benchmark, novos adaptadores, atualizações de documentação e suporte.`
          )}
        </p>
      </Block>
      <Block heading={t('Expiration does not revoke the purchased version', 'A expiração não revoga a versão comprada')}>
        <p style={LicenseS.body}>
          {t(
            'If the update plan expires, the version you already purchased keeps working. You simply stop receiving new updates and ongoing support until you renew.',
            'Se o plano de atualizações expirar, a versão que você já comprou continua funcionando. Você apenas deixa de receber novas atualizações e suporte contínuo até renovar.'
          )}
        </p>
      </Block>
      <Block heading={t('How updates are delivered', 'Como as atualizações são entregues')}>
        <p style={LicenseS.body}>
          {t(
            'While updates are active, you get access to the private GitHub repository for the system. In your project, run /update-bloo-pack (or re-apply INSTALL.md in update mode) to pull the latest passes and checklists while preserving filled conventions where possible.',
            'Enquanto as atualizações estiverem ativas, você tem acesso ao repositório privado no GitHub do sistema. No seu projeto, rode /update-bloo-pack (ou reaplique o INSTALL.md em modo de atualização) para trazer os passes e checklists mais recentes, preservando as convenções já preenchidas sempre que possível.'
          )}
        </p>
      </Block>
      <Block heading={t('Support response time', 'Prazo de resposta do suporte')}>
        <p style={LicenseS.body}>
          {t(
            `While support is active, bloo provides an initial response within ${PRODUCT.supportResponseBusinessDays} business days. Assisted founding-cohort onboarding is handled as quickly as practical, but the published commitment is a response—not a guaranteed resolution—within that window.`,
            `Enquanto o suporte estiver ativo, a bloo fornece uma resposta inicial em até ${PRODUCT.supportResponseBusinessDays} dias úteis. O onboarding assistido da coorte fundadora é atendido o mais rápido possível, mas o compromisso publicado é de resposta — não de resolução garantida — dentro desse prazo.`
          )}
        </p>
      </Block>
    </Section>
  );
}

function RefundAndPrivacy() {
  const { t } = useT();
  return (
    <Section
      sunken
      title={t('Refunds and privacy', 'Reembolsos e privacidade')}
    >
      <Block heading={t('14-day refund', 'Reembolso em 14 dias')}>
        <p style={LicenseS.body}>
          {t(
            'Try the system on real pull requests. If it is not useful for your team, request a refund within 14 days of purchase by emailing ',
            'Experimente o sistema em pull requests reais. Se não for útil para o seu time, peça o reembolso em até 14 dias após a compra enviando um e-mail para '
          )}
          <a href={`mailto:${LINKS.companyEmail}`} style={{ color: 'var(--text-link)', textDecoration: 'none' }}>{LINKS.companyEmail}</a>
          {t(
            '. When possible, include a short note on what did not work — that helps us improve, but the refund does not depend on a lengthy questionnaire.',
            '. Quando possível, inclua uma nota curta sobre o que não funcionou — isso nos ajuda a melhorar, mas o reembolso não depende de um questionário longo.'
          )}
        </p>
      </Block>
      <Block heading={t('Privacy', 'Privacidade')}>
        <p style={LicenseS.body}>
          {t(
            'bloo provides the review system and documentation. bloo does not receive or process the source code you review. Reviews run through the AI tool and provider your team already uses; that provider’s privacy, retention, and security terms still apply.',
            'A bloo fornece o sistema de revisão e a documentação. A bloo não recebe nem processa o código-fonte que você revisa. As revisões rodam pela ferramenta de IA e pelo provedor que o seu time já usa; os termos de privacidade, retenção e segurança desse provedor continuam valendo.'
          )}
        </p>
      </Block>
      <Block heading={t('No warranty', 'Sem garantia')}>
        <p style={LicenseS.body}>
          {t(
            'The system is provided as-is. AI review can miss defects and produce false positives; it does not replace tests, static analysis, security review, or human approval, and it is not a guarantee that any specific defect will be found.',
            'O sistema é fornecido no estado em que se encontra. A revisão com IA pode deixar passar defeitos e gerar falsos positivos; não substitui testes, análise estática, revisão de segurança ou aprovação humana, e não é garantia de que qualquer defeito específico será encontrado.'
          )}
        </p>
      </Block>
      <Block heading={t('Questions', 'Dúvidas')}>
        <p style={LicenseS.body}>
          {t(
            'For license, renewal, or refund questions, email ',
            'Para dúvidas sobre licença, renovação ou reembolso, escreva para '
          )}
          <a href={`mailto:${LINKS.companyEmail}`} style={{ color: 'var(--text-link)', textDecoration: 'none' }}>{LINKS.companyEmail}</a>
          .
        </p>
        <div style={LicenseS.backRow}>
          <a href="product-ai-code-review.html" style={S.cardLink}>
            <span style={{ display: 'inline-flex', transform: 'scaleX(-1)' }}><IconArrow size={16} /></span>
            {t('Back to AI Code Review System', 'Voltar ao AI Code Review System')}
          </a>
        </div>
      </Block>
    </Section>
  );
}

function LicenseContent() {
  return (
    <>
      <LicenseIntro />
      <WhatYouGet />
      <UpdatesAndSupport />
      <RefundAndPrivacy />
    </>
  );
}

window.Pages = window.Pages || {};
window.Pages.license = { Content: LicenseContent, label: 'License & updates' };
})();
