<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class SiteSetting extends Model
{
    use HasFactory;

    /**
     * The attributes that are mass assignable.
     *
     * @var array<int, string>
     */
    protected $fillable = [
        'terms_and_conditions_english',
        'terms_and_conditions_chinese',
        'privacy_policy_english',
        'privacy_policy_chinese',
        'phone',
        'whatsapp',
        'email',
        'office_hour_english',
        'office_hour_chinese',
        'address_english',
        'address_chinese',
        'google_drive_api_key',
    ];

    public function getTermsAndConditionsAttribute()
    {
        if (strtolower(app()->getLocale()) == 'zh_hk') {
            return $this->terms_and_conditions_chinese;
        }
        return $this->terms_and_conditions_english;
    }

    public function getPrivacyPolicyAttribute()
    {
        if (strtolower(app()->getLocale()) == 'zh_hk') {
            return $this->privacy_policy_chinese;
        }
        return $this->privacy_policy_english;
    }

    public function getOfficeHourAttribute()
    {
        if (strtolower(app()->getLocale()) == 'zh_hk') {
            return $this->office_hour_chinese;
        }
        return $this->office_hour_english;
    }

    public function getAddressAttribute()
    {
        if (strtolower(app()->getLocale()) == 'zh_hk') {
            return $this->address_chinese;
        }
        return $this->address_english;
    }
}
