<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class SummaryResource extends JsonResource
{
    public function toArray($request)
    {

        return [
            'id'                => $this->id,
            'co_id'             => $this->id,
            'code'              => $this->code,
            'co_name'           => $this->name,
            'total_client'      => $this->total_client,
            'total_client_new'  => $this->total_client_new,
            'client_active'     => $this->client_active,
            'client_inactive'   => $this->client_inactive,
            'client_complete'   => $this->client_complete,
            'sum_principal'     => $this->sum_principal,
            'sum_client_new'    => $this->sum_client_new,
            'sum_interest'      => $this->sum_interest,
            'sum_risk'          => $this->sum_risk,
            'sum_maintenance'   => $this->sum_maintenance,
            'paid_principal'    => $this->paid_principal,
            'paid_interest'     => $this->paid_interest,
            'paid_maintenance'  => $this->paid_maintenance,
            ////////////////////////////////////////////////
            'balance_principal'    => $this->balance_principal,
            'balance_interest'     => $this->balance_interest,
            'balance_risk'         => $this->balance_risk,
            'balance_maintenance'  => $this->balance_maintenance,
            'count_day_late'       => $this->count_day_late??0,
            'amount_day_late'      => $this->principal_late??0,
            'paid_risk'            => $this->paid_risk,
            'paid_penalty'         => $this->paid_penalty,
            'total_paid'           => $this->paid_principal+$this->paid_interest+$this->paid_risk+$this->paid_maintenance,
        ];
    }
}
