package com.example.smartlab.Fragments

import android.os.Bundle
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.example.smartlab.Models.Catalog
import com.example.smartlab.R
import com.example.smartlab.databinding.FragmentItemInformationDialogListDialogItemBinding
import com.example.smartlab.databinding.FragmentItemInformationDialogListDialogBinding

class ItemInformationDialogFragment : BottomSheetDialogFragment() {
    private var _binding: FragmentItemInformationDialogListDialogItemBinding? = null

    // This property is only valid between onCreateView and
    // onDestroyView.
    private val binding get() = _binding!!

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        _binding =
            FragmentItemInformationDialogListDialogItemBinding.inflate(inflater, container, false)
        return binding.root

    }
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        var result = arguments?.getSerializable("iteminformation") as Catalog
        with(binding) {

            fragmentCatalogName.text = result.name
            fragmentCatalogDescription.text = result.description
            fragmentCatalogInstruction.text = result.preparation
            fragmentCatalogDay.text = result.timeResul
            fragmentCatalogBio.text=result.bio

            fragmentCatalogBtnAdd.text = "Добавить за " + result.price.toString() + " ₽"

        }
    }

}