-- CreateEnum
CREATE TYPE "ParentCooperationType" AS ENUM ('FINANCIAL_SUPPORT', 'JOB_SKILL_COLLABORATION', 'PROFESSIONAL_COLLABORATION');

-- CreateTable
CREATE TABLE "parent_cooperations" (
    "id" BIGSERIAL NOT NULL,
    "parent_id" BIGINT NOT NULL,
    "type" "ParentCooperationType",
    "description" VARCHAR(500),
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "parent_cooperations_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE INDEX "parent_cooperations_parent_id_idx" ON "parent_cooperations"("parent_id");

-- CreateIndex
CREATE UNIQUE INDEX "parent_cooperations_parent_id_type_key" ON "parent_cooperations"("parent_id", "type");

-- AddForeignKey
ALTER TABLE "parent_cooperations" ADD CONSTRAINT "parent_cooperations_parent_id_fkey" FOREIGN KEY ("parent_id") REFERENCES "parents"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
