<?php

namespace App\Models;

use CodeIgniter\Model;

class SchoolSettingModel extends Model
{
    protected $table            = 'school_settings';
    protected $primaryKey       = 'id';
    protected $useAutoIncrement = true;
    protected $returnType       = 'array';
    protected $useSoftDeletes   = false;
    protected $allowedFields = [
        'school_name', 'npsn', 'nss', 'school_type',
        'address', 'village', 'district', 'city',
        'province', 'postal_code', 'phone', 'email',
        'website', 'principal_name', 'principal_nip',
        'tabungan_officer_teacher_id',
        'logo', 'logo_kemenag', 'logo_sekolah', 'accreditation',
        'letter_kemenag_office', 'letter_school_name', 'letter_school_code', 'letter_city',
        'letter_origin', 'letter_budget_code',
        'proctor_rules', 'student_rules', 'ai_provider', 'ai_api_key',
        'student_portal_editable_fields', 'student_portal_announcement',
        'storage_driver', 'google_drive_folder_id', 'google_drive_key',
        'google_client_id', 'google_client_secret', 'google_refresh_token'
    ];

    protected $useTimestamps = true;
    protected $createdField  = 'created_at';
    protected $updatedField  = 'updated_at';

    public function getSettings()
    {
        return $this->first();
    }
}
