-- CreateEnum
CREATE TYPE "BillingStatus" AS ENUM ('trialing', 'active', 'past_due', 'canceled', 'none');

-- CreateEnum
CREATE TYPE "Plan" AS ENUM ('starter', 'pro');

-- CreateEnum
CREATE TYPE "BillingCycle" AS ENUM ('monthly', 'yearly');

-- DropIndex
DROP INDEX "calendar_events_search_request_id_idx";

-- DropIndex
DROP INDEX "clients_device_contact_key_idx";

-- AlterTable
ALTER TABLE "audit_logs" ALTER COLUMN "id" DROP DEFAULT;

-- AlterTable
ALTER TABLE "calendar_events" ALTER COLUMN "id" DROP DEFAULT;

-- AlterTable
ALTER TABLE "clients" ALTER COLUMN "id" DROP DEFAULT;

-- AlterTable
ALTER TABLE "deals" ALTER COLUMN "id" DROP DEFAULT;

-- AlterTable
ALTER TABLE "demo_batches" ALTER COLUMN "id" DROP DEFAULT;

-- AlterTable
ALTER TABLE "properties" ALTER COLUMN "id" DROP DEFAULT;

-- AlterTable
ALTER TABLE "rental_contract_actions" ALTER COLUMN "id" DROP DEFAULT;

-- AlterTable
ALTER TABLE "rental_contracts" ALTER COLUMN "id" DROP DEFAULT;

-- AlterTable
ALTER TABLE "roles" ALTER COLUMN "id" DROP DEFAULT;

-- AlterTable
ALTER TABLE "search_requests" ALTER COLUMN "id" DROP DEFAULT;

-- AlterTable
ALTER TABLE "targets" ALTER COLUMN "id" DROP DEFAULT;

-- AlterTable
ALTER TABLE "users" ADD COLUMN     "billing_cycle" "BillingCycle",
ADD COLUMN     "billing_status" "BillingStatus" NOT NULL DEFAULT 'trialing',
ADD COLUMN     "plan" "Plan",
ADD COLUMN     "stripe_customer_id" TEXT,
ADD COLUMN     "stripe_subscription_id" TEXT,
ADD COLUMN     "trial_ends_at" TIMESTAMP(3),
ALTER COLUMN "id" DROP DEFAULT;

-- CreateIndex
CREATE INDEX "users_billing_status_idx" ON "users"("billing_status");

-- CreateIndex
CREATE INDEX "users_trial_ends_at_idx" ON "users"("trial_ends_at");
