<?php

namespace App\Controllers\Ajax;

use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;

class InquiryController extends AjaxController
{
  public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
  {
    parent::initController($request, $response, $logger);
    if ($this->service === null) {
      $this->service = service('inquiryservice');
    }
    $this->addActionPaths('Inquiry');
  }
  //Action작업관련
  //기본 함수 작업
  //Custom 추가 함수

  protected function create_result_process($entity, ?string $redirect_url = null): string|RedirectResponse
  {
    return $this->action_redirect_process(
      'info',
      "{$this->getTitle()}에서 {$entity->getTitle()} 문의 등록이 완료되었습니다.",
    );
  }
}
