<?php

namespace App\Http\Livewire\Profiles;

use Livewire\Component;

class ProfileTypesDropdown extends Component
{
    public $selectedTypes = [];
    public $hideLabel = false;

    protected $listeners = ['profileTypesToChildren'];

    public function profileTypesToChildren($value)
    {
        $this->selectedTypes = $value;
    }

    public function updatedSelectedTypes()
    {
        $this->dispatch('profileTypesToParent', $this->selectedTypes);
    }

    public function profileTypesSelected()
    {
        $this->dispatch('profileTypesToParent', $this->selectedTypes);
    }

    public function render()
    {
        $profileTypes = [
            'User' => __('User'),
            'Organization' => __('Organization'),
            'Bank' => __('Bank'),
            'Admin' => __('Admin')
        ];

        return view('livewire.profiles.profile-types-dropdown', compact('profileTypes'));
    }
}