-- CreateSchema
CREATE SCHEMA IF NOT EXISTS "public";

-- CreateTable
CREATE TABLE "kyc_requests" (
    "id" SERIAL NOT NULL,
    "uuid" TEXT NOT NULL,
    "user_id" VARCHAR(255) NOT NULL,
    "team_name" VARCHAR(200) NOT NULL DEFAULT '',
    "country_code" VARCHAR(2) NOT NULL DEFAULT '',
    "workflow_status" VARCHAR(20) NOT NULL DEFAULT 'pending',
    "score" INTEGER NOT NULL DEFAULT 0,
    "contact_person" VARCHAR(255) NOT NULL DEFAULT '',
    "contact_email" VARCHAR(254) NOT NULL DEFAULT '',
    "contact_phone" VARCHAR(50) NOT NULL DEFAULT '',
    "content_type_id" INTEGER,
    "object_id" INTEGER,
    "approved_by" VARCHAR(255),
    "approved_at" TIMESTAMP(3),
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

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

-- CreateTable
CREATE TABLE "kyc_monitoring" (
    "id" SERIAL NOT NULL,
    "uuid" TEXT NOT NULL,
    "user_id" VARCHAR(255) NOT NULL,
    "team_name" VARCHAR(200) NOT NULL DEFAULT '',
    "country_code" VARCHAR(2) NOT NULL DEFAULT '',
    "workflow_status" VARCHAR(20) NOT NULL DEFAULT 'pending',
    "score" INTEGER NOT NULL DEFAULT 0,
    "contact_person" VARCHAR(255) NOT NULL DEFAULT '',
    "contact_email" VARCHAR(254) NOT NULL DEFAULT '',
    "contact_phone" VARCHAR(50) NOT NULL DEFAULT '',
    "content_type_id" INTEGER,
    "object_id" INTEGER,
    "approved_by" VARCHAR(255),
    "approved_at" TIMESTAMP(3),
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

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

-- CreateTable
CREATE TABLE "kyc_details_russia" (
    "id" SERIAL NOT NULL,
    "company_name" VARCHAR(255) NOT NULL,
    "company_full_name" TEXT NOT NULL,
    "inn" VARCHAR(12) NOT NULL,
    "kpp" VARCHAR(9) NOT NULL DEFAULT '',
    "ogrn" VARCHAR(15) NOT NULL DEFAULT '',
    "address" TEXT NOT NULL,
    "bank_name" VARCHAR(255) NOT NULL,
    "bik" VARCHAR(9) NOT NULL,
    "correspondent_account" VARCHAR(20) NOT NULL DEFAULT '',

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

-- CreateIndex
CREATE UNIQUE INDEX "kyc_requests_uuid_key" ON "kyc_requests"("uuid");

-- CreateIndex
CREATE INDEX "kyc_requests_user_id_idx" ON "kyc_requests"("user_id");

-- CreateIndex
CREATE UNIQUE INDEX "kyc_monitoring_uuid_key" ON "kyc_monitoring"("uuid");

-- CreateIndex
CREATE INDEX "kyc_monitoring_user_id_idx" ON "kyc_monitoring"("user_id");

