<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Relations\BelongsTo;

class DailySalesSummary extends BasePosModel
{
    protected $table = 'daily_sales_summary';

    protected function casts(): array
    {
        return [
            'summary_date' => 'date',
            'total_items_sold' => 'decimal:4',
            'gross_sales' => 'decimal:4',
            'total_discounts' => 'decimal:4',
            'total_taxes' => 'decimal:4',
            'net_sales' => 'decimal:4',
            'total_cost' => 'decimal:4',
            'gross_profit' => 'decimal:4',
            'total_returns' => 'decimal:4',
            'cash_payments' => 'decimal:4',
            'mpesa_payments' => 'decimal:4',
            'card_payments' => 'decimal:4',
            'other_payments' => 'decimal:4',
            'total_expenses' => 'decimal:4',
        ];
    }

    public function company(): BelongsTo
    {
        return $this->belongsTo(Company::class);
    }

    public function branch(): BelongsTo
    {
        return $this->belongsTo(Branch::class);
    }
}
