<?php

namespace Server\Controllers\Validators;

use Server\Database\Models\User;

class DepositsValidator extends ApiValidator
{
    public function apiUpdate($body)
    {
        $errors = [];

        $id = $body['id'] ?? '';
        $user_id = $body['user_id'] ?? '';

        if (!is_numeric($id)) {
            array_push($errors, "id must be a number");
        }

        if (!is_numeric($user_id)) {
            array_push($errors, "user id must be a number");
        }

        $user = User::where('id', $body['user_id'])->first();

        if (!$user) {
            return ["user not found"];
        }

        return $errors;
    }
}
