<?php

namespace App\Http\Controllers;


use App\Models\data_bumdes;
use App\Models\data_distrik_bumdes;
use Illuminate\Http\Request;
use App\Models\data_distrik_caltrans;
use App\Models\data_pribadi_bumdes;
use App\Http\Requests\Storedata_bumdesRequest;
use App\Http\Requests\Updatedata_bumdesRequest;

class DataBumdesController extends Controller
{
    /**
     * Display a listing of the resource.
     */
    public function savebumdes(Request $request){
        data_pribadi_bumdes::create([
            "nip" => $request->nip,
            "nama_lengkap"=>$request->nama_lengkap,
            "pangkat"=>$request->pangkat,
            "jabatan"=>$request->jabatan,
            "instansi"=>$request->instansi,
            "kabupaten"=>$request->kabupaten,
            "phone_number"=>$request->phone_number,
            "pesan"=>$request->pesan,
            "alamat"=>$request->alamat
        ]);
        data_distrik_bumdes::create([
            "nama_distrik"=>$request->nama_distrik,
            "jumlah_kampung"=>$request->jumlah_kampung,
            "jumlah_penduduk"=>$request->jumlah_penduduk
        ]);
        data_bumdes::create([
            "pendidikan"=>$request->pendidikan,
            "pertanian"=>$request->pertanian,
            "peternakan"=>$request->peternakan,
            "perikanan"=>$request->perikanan,
            "perkebunan"=>$request->perkebunan,
            "kehutanan"=>$request->kehutanan,
            "lain_lain"=>$request->lain_lain,
            "potensi_aset"=>$request->potensi_aset,
            "jenis_pelatihan"=>$request->jenis_pelatihan,
            "kelembagaan_adat"=>$request->kelembagaan_adat,
            "kelembagaan_sosial"=>$request->kelembagaan_sosial,
            "bumdes_sudah_berbadan"=>$request->bumdes_sudah_berbadan,
            "bumdes_belum_berbadan"=>$request->bumdes_belum_berbadan,
            "jenis_usaha_bumdes"=>$request->jenis_usaha_bumdes,
            "jarak_tempuh_bandara"=>$request->jarak_tempuh_bandara,
            "jarak_tempuh_kampung"=>$request->jarak_tempuh_kampung,
            "sharing_information"=>$request->sharing_information,
        ]);
        $response=[
            'nip' => $request->nip,
            'nama_lengkap' => $request->nama_lengkap,
            'pangkat' => $request->pangkat,
            'jabatan' => $request->jabatan,
            'instansi' => $request->instansi,
            'kabupaten' => $request->kabupaten,
            'phone_number' => $request->phone_number,
            'pesan' => $request->pesan,
            'alamat' => $request->alamat,
            'nama_distrik' => $request->nama_distrik,
            'jumlah_kampung' => $request->jumlah_kampung,
            'jumlah_penduduk' => $request->jumlah_penduduk,
            'pendidikan' => $request->pendidikan,
            'pertanian' => $request->pertanian,
            'peternakan' => $request->peternakan,
            'perikanan' => $request->perikanan,
            'perkebunan' => $request->perkebunan,
            'kehutanan' => $request->kehutanan,
            'lain_lain' => $request->lain_lain,
            'potensi_aset' => $request->potensi_aset,
            'kelembagaan_adat' => $request->kelembagaan_adat,
            'kelembagaan_sosial' => $request->kelembagaan_sosial,
            'bumdes_sudah_berbadan' => $request->bumdes_sudah_berbadan,
            'bumdes_belum_berbadan' => $request->bumdes_belum_berbadan,
            'jenis_usaha_bumdes' => $request->jenis_usaha_bumdes,
            'jarak_tempuh_bandara' => $request->jarak_tempuh_bandara,
            'jarak_tempuh_kampung' => $request->jarak_tempuh_kampung,
            'jenis_pelatihan' => $request->jenis_pelatihan,
            // 'kampung_binaan' => $request->kampung_binaan,
            'sharing_information' => $request->sharing_information,
        ];
        return response()->json(['data' => $response, 'message' => 'Data berhasil disimpan']);

    }

      public function index()
    {
        //
    }

    /**
     * Show the form for creating a new resource.
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     */
    public function store(Storedata_bumdesRequest $request)
    {
        //
    }

    /**
     * Display the specified resource.
     */
    public function show(data_bumdes $data_bumdes)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     */
    public function edit(data_bumdes $data_bumdes)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     */
    public function update(Updatedata_bumdesRequest $request, data_bumdes $data_bumdes)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     */
    public function destroy(data_bumdes $data_bumdes)
    {
        //
    }
}