-- Migration 107: AGB EN v2 — English Terms and Conditions
-- English version of the AGB SaaS/Shop template (Migration 090)
-- EU/UK law compatible, same structure and IF-blocks as DE version

INSERT INTO compliance_legal_templates (
    id, tenant_id, document_type, title, description, content,
    placeholders, language, jurisdiction,
    license_id, license_name, source_name,
    attribution_required, is_complete_document, version, status,
    created_at, updated_at
) SELECT
    gen_random_uuid(),
    '9282a473-5c95-4b3a-bf78-0ecc0ec71d3e',
    'agb',
    'Terms and Conditions (SaaS/Shop, EU-compliant)',
    'General Terms and Conditions for SaaS/Cloud services and online shops. 18 sections with modular IF-blocks for B2B/B2C, trial period, physical goods, IoT bundles, IP indemnification, force majeure. EU/UK law compatible.',
    $template$# General Terms and Conditions

**{{COMPANY_LEGAL_NAME}}**
Effective: {{VERSION_DATE}}

---

## § 1 Scope

(1) These Terms and Conditions ("Terms") apply to all contracts between {{COMPANY_LEGAL_NAME}} ("Provider") and the customer regarding the use of **{{SERVICE_NAME}}**.

(2) Any deviating terms of the customer shall not become part of the contract unless the Provider expressly agrees in writing.

{{#IF B2B_ONLY}}
(3) These Terms are exclusively directed at entrepreneurs within the meaning of applicable commercial law. Contracts with consumers are not concluded.
{{/IF}}
{{#IF_NOT B2B_ONLY}}
(3) These Terms apply to both businesses and consumers unless expressly stated otherwise.
{{/IF_NOT}}

---

## § 2 Description of Services

(1) The Provider makes **{{SERVICE_NAME}}** available as web-based software (Software as a Service) including maintenance and support: {{SERVICE_DESCRIPTION_SHORT}}.

(2) The scope of services and system requirements are set out in the current service description.

{{#IF HAS_MODULAR_PACKAGES}}
(3) The software is offered in various packages with different feature sets. The specific scope of services is determined by the selected package.
{{/IF}}

{{#IF HAS_END_USERS}}
(4) The customer may make the software available to its end users within the scope of the contractual purpose. No contractual relationship is established between the Provider and the customer's end users.
{{/IF}}

(5) The Provider does not review the content entered by the customer for accuracy or legal compliance. Content responsibility lies with the customer.

(6) The Provider is entitled to further develop the service, provided that core functionalities are essentially maintained.

---

## § 3 Conclusion of Contract

(1) The presentation of the service on the website does not constitute a binding offer.

(2) The contract is concluded upon confirmation of the order or activation of the service.

{{#IF HAS_TRIAL}}
(3) The Provider offers a free trial period of {{TRIAL_DAYS}} days. If the subscription is not cancelled during the trial period, the contract becomes chargeable. A Data Processing Agreement (DPA) is required from the start of the trial.
{{/IF}}

---

## § 4 Prices, Billing, Payment

{{#IF HAS_PAID_PLANS}}
(1) The prices agreed at the time of contract conclusion apply: {{PRICES_TEXT}}.

(2) Payment terms: {{PAYMENT_TERMS_TEXT}}.

(3) All prices are exclusive of applicable VAT.

(4) In the event of late payment, statutory default interest shall apply.

(5) Additional services beyond the agreed scope of services (e.g. error correction due to improper use, individual customisations) require separate commissioning and remuneration.

{{#IF HAS_PRICE_ADJUSTMENT}}
(6) The Provider may adjust the agreed fees at its reasonable discretion if costs attributable to the contract increase or decrease due to unforeseeable circumstances arising after conclusion of the contract. Price increases may only occur once per calendar year and only to the extent that the Provider does not generate profits exceeding cost coverage. Where cost reductions are not temporary, the Provider is obliged to reduce prices accordingly.

(7) The customer shall be notified of price changes at least {{PRICE_ADJUSTMENT_NOTICE_WEEKS}} weeks before they take effect. In the event of price increases, the customer has a special right of termination effective as of the date the increase takes effect.
{{/IF}}
{{/IF}}
{{#IF_NOT HAS_PAID_PLANS}}
(1) The service is currently offered free of charge. The Provider reserves the right to introduce paid service tiers.
{{/IF_NOT}}

---

## § 5 Customer Obligations

(1) The customer shall provide accurate information upon registration and keep it up to date.

(2) Access credentials shall be kept confidential. The customer shall ensure that unauthorised third parties do not gain access to the account.

(3) The service may only be used in accordance with applicable law and these Terms.

(4) The customer is responsible for uploaded content and data and shall ensure that third-party rights are not infringed. {{#IF HAS_END_USERS}} The customer shall obligate its end users accordingly. {{/IF}} The customer shall indemnify the Provider against all third-party claims arising from unlawful use.

(5) The customer is obliged to make payments on time.

(6) The Provider may introduce additional security measures and shall inform the customer accordingly. The customer is obliged to implement reasonable security measures.

(7) The customer is additionally responsible for regular backup of its data using the available export functions.

---

## § 6 Rights of Use

(1) The Provider grants the customer a simple, non-transferable, time-limited right of use for the software within the scope of the current service description. Use includes loading into working memory and installation on the customer's devices and servers.

(2) The services provided by the Provider are protected by intellectual property rights, in particular copyright{{#IF HAS_TRADEMARK}}, trademark law{{/IF}}{{#IF HAS_PATENTS}}, patent law{{/IF}}. Copyright notices, logos, trademarks and other identifying features must not be altered or removed.

(3) Any transfer to third parties, sublicensing or making publicly available beyond the intended use is prohibited.

(4) Reverse engineering, decompilation and circumvention of security mechanisms are prohibited to the extent permitted by law.

{{#IF HAS_TDM_OPTOUT}}
(5) The use of the services for text and data mining or the development, training or enrichment of AI systems is prohibited without the Provider's express consent.
{{/IF}}

{{#IF HAS_API_ACCESS}}
(6) Use of the provided API is permitted within the scope of the documented interfaces and agreed rate limits.
{{/IF}}

{{#IF HAS_MAINTENANCE_ACCESS}}
(7) The Provider shall have remote access to customer-operated installations for maintenance and support purposes.
{{/IF}}

---

## § 7 Availability, Maintenance and Support

(1) The availability of the software is {{AVAILABILITY_PERCENT}} percent on an annual average. {{#IF HAS_MAX_DOWNTIME}} Availability shall not be impaired for more than {{MAX_DOWNTIME_DAYS}} consecutive calendar days. {{/IF}} Scheduled maintenance and force majeure events are excluded.

(2) The Provider performs regular maintenance and provides updates. The software shall be used in its current version. Scheduled maintenance shall be announced {{MAINTENANCE_NOTICE_HOURS}} hours in advance.

(3) Support is available: {{SUPPORT_HOURS}}. Support channels: {{SUPPORT_CHANNELS_TEXT}}.

(4) The customer shall report software errors with as precise a description as possible and shall cooperate in error resolution.

(5) Errors are processed according to the following criticality levels:

| Category | Impact | Response Time |
|----------|--------|:---:|
| Normal | No or minor impact | {{RESPONSE_LOW_H}} hours |
| High | Business operations impaired | {{RESPONSE_HIGH_H}} hours |
| Critical | Imminent financial or operational damage | {{RESPONSE_CRITICAL_H}} hours |

(6) Response times refer to the period until processing begins, not until the error is resolved. They apply exclusively within service hours.

---

## § 8 Data Storage and Export

(1) The Provider takes appropriate technical and organisational measures to protect against data loss and unauthorised access in accordance with the state of the art.

(2) The customer remains the sole owner of its data. The Provider has neither a right of retention nor a lien on the customer's data.

(3) The customer may request the return of its data in a common, machine-readable format at any time.

---

## § 9 Data Protection

(1) The Provider processes personal data entered by the customer or its users as a processor within the meaning of Art. 28 GDPR. The details are governed by the separately concluded Data Processing Agreement (DPA).

(2) The Provider shall not use the data for its own purposes.

(3) The customer is independently responsible for fulfilling its data protection information obligations (Art. 13/14 GDPR).

(4) The Provider's privacy policy is available at: {{PRIVACY_POLICY_URL}}.

---

## § 10 Suspension

(1) The Provider is entitled to suspend access if the customer is in default of payment despite a reminder with a reasonable grace period.

(2) The Provider may also suspend access if there is a reasonable suspicion that the software is being used in violation of applicable law, these Terms or the terms of use.

(3) During a suspension, the customer retains access to data export.

---

## § 11 Warranty

(1) The customer shall report defects without undue delay after discovery.

(2) The Provider shall remedy defects at its discretion by repair or provision of a defect-free version. The Provider shall be granted at least two attempts at remedy.

(3) Warranty for merely insignificant reductions in fitness is excluded.

{{#IF HAS_DIGITAL_CONTENT}}
(4) Warranty for defects resulting from the customer's failure to install required and freely provided updates is excluded.
{{/IF}}

---

## § 12 Liability

(1) The Provider shall have unlimited liability for intent, gross negligence and injury to life, body or health.

(2) For slightly negligent breach of material contractual obligations (cardinal obligations), liability is limited to the typical, foreseeable damage.

(3) Otherwise, liability is excluded to the extent permitted by law.

(4) For data loss, the Provider shall only be liable to the extent that the damage would also have occurred with proper data backup by the customer.

(5) Statutory liability under product liability law remains unaffected.

{{#IF IS_B2B}}
(6) Liability for slight negligence is limited to {{LIABILITY_MULTIPLIER}} times the annual net remuneration.
{{/IF}}

{{#IF HAS_IP_INDEMNIFICATION}}
(9) The Provider warrants that the contractual use of the software is free from third-party intellectual property rights. If a third party asserts claims against the customer due to an IP infringement, the Provider shall defend the customer at its own expense.
{{/IF}}

---

## § 13 Term and Termination

(1) The contract term is determined by the selected billing period (monthly or annual). The contract may be terminated at the end of the respective term.

(2) If the contract is not terminated in due time, it shall automatically renew for the current billing period.

(3) The right to extraordinary termination for good cause remains unaffected.

(4) Fees already paid for unused billing periods are not refunded upon ordinary termination. Mandatory statutory refund claims remain unaffected.

(5) Termination may be made in text form or via the cancellation function provided in the customer portal.

---

## § 14 Data Upon Termination

(1) After termination, all personal data of the customer shall be deleted or returned in accordance with the DPA. The deletion period is {{DELETION_DAYS}} days after contract end.

(2) Contract data (invoices, correspondence) are exempt from deletion to the extent that statutory retention obligations exist.

---

## § 15 Confidentiality

(1) The parties undertake to treat all confidential information of the other party obtained in the course of the contractual relationship as confidential. This obligation shall survive termination.

(2) The confidentiality obligation does not apply to information that (a) is or becomes publicly known, (b) was already lawfully known to the receiving party, (c) is transmitted by a third party without confidentiality obligations, or (d) must be disclosed by law or official order.

---

## § 16 Amendments

(1) The Provider may amend these Terms for objective reasons (e.g. changes in legislation). This amendment mechanism does not apply to changes that materially alter the balance of performance and consideration, in particular not to price increases.

(2) Amendments shall be announced in text form at least one month before they take effect.

(3) If no objection is raised within the specified period, the amendments shall be deemed accepted.

---

## § 17 Final Provisions

(1) Amendments and supplements to this contract require text form.

(2) The law of the Federal Republic of Germany shall apply, excluding the UN Convention on Contracts for the International Sale of Goods (CISG). {{#IF HAS_EU_USERS}} For consumers resident in the EU, the mandatory consumer protection provisions of their country of residence shall additionally apply. {{/IF}}

{{#IF IS_B2B}}
(3) The place of jurisdiction for merchants and legal entities is {{JURISDICTION_CITY}}.
{{/IF}}

(4) Should individual provisions be invalid, the validity of the remaining provisions shall remain unaffected.

(5) Components of this contract include, in addition to these Terms, the Data Processing Agreement (DPA) {{#IF HAS_COMMUNITY_GUIDELINES}} and the Community Guidelines {{/IF}}.

{{#IF HAS_FORCE_MAJEURE}}
(6) Unforeseeable events beyond the control of the parties (force majeure) that materially impede or render impossible the performance of obligations shall entitle the affected party to postpone performance for the duration of the impediment. Payment obligations remain unaffected.
{{/IF}}

---

*Generated with BreakPilot Compliance — {{COMPANY_LEGAL_NAME}} | {{VERSION_DATE}}*
$template$,
    '["COMPANY_LEGAL_NAME","VERSION_DATE","SERVICE_NAME","SERVICE_DESCRIPTION_SHORT","PRIVACY_POLICY_URL","AVAILABILITY_PERCENT","MAINTENANCE_NOTICE_HOURS","SUPPORT_HOURS","SUPPORT_CHANNELS_TEXT","RESPONSE_LOW_H","RESPONSE_HIGH_H","RESPONSE_CRITICAL_H","PRICES_TEXT","PAYMENT_TERMS_TEXT","PRICE_ADJUSTMENT_NOTICE_WEEKS","TRIAL_DAYS","DELETION_DAYS","LIABILITY_MULTIPLIER","JURISDICTION_CITY","SLA_URL"]'::jsonb,
    'en', 'EU',
    'mit', 'MIT License', 'BreakPilot Compliance',
    false, true, '2.0.0', 'published',
    NOW(), NOW()
WHERE NOT EXISTS (
    SELECT 1 FROM compliance_legal_templates
    WHERE document_type = 'agb' AND language = 'en' AND version = '2.0.0'
    AND tenant_id = '9282a473-5c95-4b3a-bf78-0ecc0ec71d3e'
);
