1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 
<?php
    declare(strict_types=1);
    /**
     * Copyright (C) Apis Networks, Inc - All Rights Reserved.
     *
     * Unauthorized copying of this file, via any medium, is
     * strictly prohibited without consent. Any dissemination of
     * material herein is prohibited.
     *
     * For licensing inquiries email <licensing@apisnetworks.com>
     *
     * Written by Matt Saladna <matt@apisnetworks.com>, July 2017
     */

    /**
     * User tracking, trouble tickets
     *
     * @package core
     */
    class Crm_Module extends Module_Skeleton
    {
        const FROM_ADDRESS = CRM_FROM_ADDRESS;

        // @ignore
        const REPLY_ADDRESS = CRM_REPLY_ADDRESS;
        const FROM_NAME = CRM_FROM_NAME;
        const FROM_NO_REPLY_ADDRESS = CRM_FROM_NO_REPLY_ADDRESS;
        const MAX_SMS_LENGTH = 150;
        // lowercase list of ticket subject priorities that cannot change
        const COPY_ADMIN = CRM_COPY_ADMIN;

        const TICKET_STCLOSE = 'close';
        const TICKET_STAPPEND = 'append';
        const TICKET_STOPEN = 'open';
        const PRIORITIES = array('normal', 'high', 'outage');
        const LOW_PRIORITY_SUBJECTS = array('billing');

        // @var string
        // @ignore
        const SHORT_COPY_ADMIN = CRM_SHORT_COPY_ADMIN;

        // @ignore
        private static $CRM_SERVER_HOST = CRM_TICKET_HOST;
        // @ignore
        private static $CRM_SERVER_USER = CRM_TICKET_USER;
        // @ignore
        private static $CRM_SERVER_PASSWORD = CRM_TICKET_PASSWORD;
        // @ignore
        private static $CRM_SERVER_DATABASE = CRM_TICKET_DB;

        /**
         * void __construct(void)
         *
         * @ignore
         */
        public function __construct()
        {
            parent::__construct();
            $this->exportedFunctions = array(
                '*'                       => PRIVILEGE_SITE | PRIVILEGE_ADMIN,
                'append_ticket_via_email' => PRIVILEGE_ADMIN,
                'get_notifications'       => PRIVILEGE_ALL,
                'cancel_notification'     => PRIVILEGE_ALL,

            );
        }

        /**
         * CRM enabled for user
         *
         * @return bool
         */
        public function enabled(): bool
        {
            return $this->configured() &&
                ($this->permission_level & PRIVILEGE_ADMIN || !$this->getServiceValue('billing', 'parent_invoice'));
        }

        /**
         * Verify CRM module is configured
         *
         * @return bool
         */
        public function configured(): bool
        {
            return false;
        }

        /**
         * Get pending notifications
         *
         * @return array
         */
        public function get_notifications(): array
        {
            return [];
        }
    }