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

class Contact_model extends CI_Model {
    
    public function __construct() {
       log_message('info', 'Contact Model Class Initialized');
    }
    
    public function get_contact_settings() {
        $this->db->where('is_active', 1);
        $this->db->limit(1);
        $query = $this->db->get('contact_settings');
        return $query->row();
    }
    
    public function update_contact_settings($data) {
        $this->db->where('is_active', 1);
        return $this->db->update('contact_settings', $data);
    }
    
    public function save_inquiry($data) {
        return $this->db->insert('contact_inquiries', $data);
    }
    
    public function get_all_inquiries() {
        $this->db->order_by('created_at', 'DESC');
        return $this->db->get('contact_inquiries')->result();
    }
}
?>