<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {

        Schema::create('medical_history_answer', function (Blueprint $table) {
            $table->id();
            $table->text('question_key')->nullable();
            $table->unsignedBigInteger('patient_id');
            $table->foreign('patient_id')->references('id')->on('patients');
            $table->string('type')->nullable();
            $table->text('answer')->nullable();
            $table->timestamps();
        });

        $json = '[
            {
              "KEY": "why_interested_hrt",
              "Value": "",
              "TYPE": "text"
            },
            {
              "KEY": "goal_loss_weight",
              "Value": "yes, no",
              "TYPE": "radio"
            },
            {
              "KEY": "what_biological_sex",
              "Value": "male, female",
              "TYPE": "radio"
            },
            {
              "KEY": "3_years_physical_test",
              "Value": "yes, no",
              "TYPE": "radio"
            },
            {
              "KEY": "medical_problems",
              "Value": "yes, no",
              "TYPE": "radio"
            },
            {
              "KEY": "have_prostate_cancer",
              "Value": "yes, no",
              "TYPE": "radio"
            },
            {
              "KEY": "what_height",
              "Value": "5 ft 1 in, 5 ft 2 in",
              "TYPE": "dropdown"
            },
            {
              "KEY": "whight",
              "Value": "",
              "TYPE": "text"
            },
            {
              "KEY": "birthdate",
              "Value": "12/03/1991",
              "TYPE": "date"
            },
            {
              "KEY": "past_harmone_treatments",
              "Value": "thyroid_medication, testosterone_treatment, estrogen_blocker, hgh, ipamoreline, colomipheine, hcg, other, none",
              "TYPE": "checkbox"
            },
            {
              "KEY": "take_medications",
              "Value": "yes, no",
              "TYPE": "radio"
            },
            {
              "KEY": "have_medications_allegies",
              "Value": "yes, no",
              "TYPE": "radio"
            },
            {
              "KEY": "plan_children",
              "Value": "yes, no",
              "TYPE": "radio"
            },
            {
              "KEY": "partner_pregnant",
              "Value": "yes, no, not applicab_e",
              "TYPE": "radio"
            },
            {
              "KEY": "experience_ed",
              "Value": "never, almost_never, occasionally, almost_always, always",
              "TYPE": "radio"
            },
            {
              "KEY": "thyroid_disorders",
              "Value": "yes, no",
              "TYPE": "radio"
            },
            {
              "KEY": "family_history",
              "Value": "drug_alcohol, cancer, heart_disease, thyroid_disease, low_testosterone, none",
              "TYPE": "checkbox"
            },
            {
              "KEY": "patient_concent",
              "Value": "",
              "TYPE": "checkbox"
            },
            {
              "KEY": "appointment_cancel",
              "Value": "",
              "TYPE": "checkbox"
            },
            {
              "KEY": "medicare_disclaimer",
              "Value": "",
              "TYPE": "checkbox"
            },
            {
              "KEY": "telehealth_concent",
              "Value": "",
              "TYPE": "checkbox"
            },
            {
              "KEY": "secondary_contact",
              "Value": "",
              "TYPE": "checkbox"
            }
          ]';
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('medical_history_answer');
    }
};
