<?php
defined('BASEPATH') or exit('No direct script access allowed');

class Account extends MY_ApiController
{
    public function __construct()
    {
        parent::__construct();
    }

    public function change_password()
    {
        $this->is_post();
        $this->is_json();

        $params = $this->json;

        $tenant_no = $params['tenant_no'];
        $parent_id = $params['parent_id'];

        $this->load->model('Parent_model');
        $this->Parent_model->setTenantNo($tenant_no, true);
        $this->Parent_model->reset_password($params, $parent_id);

        echo $this->respond([]);
    }

    public function unpaid_badge()
    {
        $this->is_get();
        $params = $this->input->get();

        $studentId = $params['student_id'];

        $this->load->model('Invoicing_model');
        $count = $this->Invoicing_model->unpaid_badge($studentId);

        echo $this->respond($count);
    }


    public function toggle_push()
    {

        $this->is_get();
        $this->is_post();

        $params = $this->json;

        $tenant_no = $params['tenant_no'];
        $parent_id = $params['parent_id'];
        $disabled_push = $params['disabled_push'];

        $this->load->model('Parents_model');
        $this->Parents_model->setTenantNo($tenant_no, true);
        $this->Parents_model->save(['disabled_push' => $disabled_push], $parent_id);

        echo $this->respond([]);
    }
}
