<?php

namespace App\Helpers;

use App\Models\UserSNSModel;

class UserSNSHelper extends CommonHelper
{
    public function __construct()
    {
        parent::__construct();
    }
    public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
    {
        $value = $value ?: DEFAULTS['EMPTY'];
        switch ($field) {
            case 'id':
            case UserSNSModel::TITLE:
                $form = form_input($field, $value, $extras);
                break;
            case 'email':
                $form = form_input($field, $value, ["placeholder" => "예)test@example.com", ...$extras]);
                break;
            case 'detail':
                $form = form_textarea($field, $value == DEFAULTS['EMPTY'] ? "@\n*\nm\nwww" : $value, [
                    'rows' => '20',
                    ...$extras
                ]);
                break;
            default:
                $form = parent::getFieldForm($field, $value, $viewDatas, $extras);
                break;
        }
        return $form;
    } //
}
