import type { Metadata } from "next";
import Link from "next/link";
import { LegalPageLayout } from "@/components/LegalPageLayout";
import { LEGAL_OPERATOR } from "@/lib/legal/constants";

export const metadata: Metadata = {
  title: "Refund Policy",
  description: "Refund and cancellation policy for Songs2VID paid plans.",
  alternates: { canonical: "https://songs2vid.com/refund" },
};

export default function RefundPage() {
  return (
    <LegalPageLayout
      title="Refund Policy"
      description="Our policy on refunds, cancellations, and billing for paid plans."
    >
      <h2>1. Overview</h2>
      <p>
        This Refund Policy explains how refunds and cancellations work for paid Songs2VID plans and
        credit purchases. The free monthly Bedroom Producer allocation does not involve payment and
        is not subject to refunds; optional Free-plan extra credit purchases are covered in section
        2.
      </p>

      <h2>2. Free plan and extra credits</h2>
      <p>
        The Bedroom Producer (Free) monthly allocation is provided at no charge. Free users may
        optionally purchase extra video credits (currently €0.25 each, 1–15 per checkout, Free extras
        balance capped at 15). Once extra credits are granted to your account, those one-time
        purchases are <strong>generally non-refundable</strong>, except where mandatory consumer law
        requires otherwise. Credits trimmed under the account accumulation cap (see our{" "}
        <Link href="/terms">Terms of Service</Link>) are not refundable.
      </p>

      <h2>3. Pro subscriptions</h2>
      <h3>3.1 Billing cycle</h3>
      <p>
        Pro plans are billed on a recurring monthly basis unless otherwise stated at checkout.
        Your subscription renews automatically until cancelled.
      </p>

      <h3>3.2 14-day refund window</h3>
      <p>
        If you are a new Pro subscriber, you may request a full refund within <strong>14 days</strong> of
        your initial purchase, provided you have not substantially consumed paid entitlements
        (for example, a large portion of your monthly video quota or premium-only features).
      </p>

      <h3>3.3 After the refund window</h3>
      <p>
        After 14 days, subscription fees are generally non-refundable for the current billing
        period. You may cancel at any time to prevent future renewals. Access typically continues
        until the end of the paid period.
      </p>

      <h3>3.4 Cancellation</h3>
      <p>
        You can cancel your subscription through your account billing settings (choose{" "}
        <strong>cancel immediately</strong> or <strong>at the end of the billing period</strong>) or
        via the Stripe customer portal / by contacting{" "}
        <a href={`mailto:${LEGAL_OPERATOR.email}`}>{LEGAL_OPERATOR.email}</a>. Cancelling at period
        end keeps Pro access until the paid period finishes and stops future renewals. Cancelling
        immediately ends Pro access and moves you to the Free plan right away (including loss of Pro
        API access). Cancellation does not automatically delete your account; use{" "}
        <strong>Dashboard → Settings</strong> or contact us if you want permanent account deletion.
      </p>

      <h2>4. Enterprise and custom agreements</h2>
      <p>
        Enterprise, managed cloud, and paid self-hosted setup fees are governed by the individual
        quote or contract signed with us. Refund terms for those services are specified in your
        agreement. Contact{" "}
        <a href={`mailto:${LEGAL_OPERATOR.salesEmail}`}>{LEGAL_OPERATOR.salesEmail}</a> for
        contract-related billing questions.
      </p>

      <h2>5. Non-refundable situations</h2>
      <p>Refunds are generally not provided when:</p>
      <ul>
        <li>The refund request is made outside the applicable refund window</li>
        <li>The account was terminated for violation of our <Link href="/terms">Terms of Service</Link></li>
        <li>The issue is caused by third-party services outside our control (e.g. YouTube API outages, Google account restrictions)</li>
        <li>You simply changed your mind after substantial use of paid quota or features</li>
        <li>Purchased Free-plan extra credits have already been granted to your account</li>
        <li>Credits expired or were trimmed under the 30-credit accumulation cap</li>
        <li>One-time setup or license fees after delivery of agreed setup work, unless required by law or contract</li>
      </ul>

      <h2>6. Chargebacks</h2>
      <p>
        If you believe a charge is incorrect, please contact us before initiating a chargeback so
        we can resolve the issue promptly. Unjustified chargebacks may result in account suspension.
      </p>

      <h2>7. How to request a refund</h2>
      <p>Email us at <a href={`mailto:${LEGAL_OPERATOR.email}`}>{LEGAL_OPERATOR.email}</a> with:</p>
      <ul>
        <li>Your account email address</li>
        <li>Date of purchase and invoice or transaction reference if available</li>
        <li>Reason for the refund request</li>
      </ul>
      <p>We aim to respond within 5 business days. Approved refunds are issued to the original payment method where possible.</p>

      <h2>8. Consumer rights</h2>
      <p>
        Nothing in this policy limits mandatory statutory rights you may have as a consumer under
        applicable law, including withdrawal rights where required by EU or local consumer
        protection regulations.
      </p>

      <h2>9. Changes</h2>
      <p>
        We may update this Refund Policy from time to time. The version published on this page
        applies to purchases made after the effective date shown at the top.
      </p>
    </LegalPageLayout>
  );
}
