<?php

namespace Modules\Patient\Services;

use Modules\Patient\Repositories\PatientRepository;
use Illuminate\Support\Facades\DB;
use Modules\Patient\Models\Patient;
use Modules\Patient\DTO\PatientSettingFilter;

class PatientService
{
    protected $patientRepo;

    public function __construct(
        PatientRepository $patientRepo
    ) {
        $this->patientRepo = $patientRepo;
    }

    public function list(PatientSettingFilter $filter)
    {
        $columns = [
            'id',
            'name',
            'bts_id',
            'phone',
            'dob',
            'gender',
            'current_fund_id',
        ];
        $relations = ['currentFund:id,name,code'];
        return $this->patientRepo->all($filter, $columns, $relations);
    }


    public function patientList(PatientSettingFilter $filter)
    {
        $columns = [
            'id',
            'name',
            'bts_id',
            'phone',
        ];
        return $this->patientRepo->all($filter, $columns);
    }


    public function show($id)
    {
        return $this->patientRepo->find($id);
    }

    public function syncFromErp(array $data)
    {
        return $this->patientRepo->syncFromErp($data);
    }
}
