-- CreateEnum
CREATE TYPE "GenderEnum" AS ENUM ('MAN', 'WOMAN', 'UNKNOWN');

-- CreateTable
CREATE TABLE "users" (
    "id" BIGSERIAL NOT NULL,
    "fullname" VARCHAR(100) NOT NULL,
    "mobile" VARCHAR(100) NOT NULL,
    "mobile_verified_at" TIMESTAMP(3),
    "password" VARCHAR(100),
    "gender" "GenderEnum" NOT NULL DEFAULT 'UNKNOWN',
    "profile_image" VARCHAR(255),
    "nationalCode" VARCHAR(50) NOT NULL,
    "email" VARCHAR(250) NOT NULL,
    "is_active" BOOLEAN NOT NULL DEFAULT true,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deactivated_at" TIMESTAMP(3),
    "deactivated_by_id" BIGINT,

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

-- AddForeignKey
ALTER TABLE "users" ADD CONSTRAINT "users_deactivated_by_id_fkey" FOREIGN KEY ("deactivated_by_id") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
