<?php

/**
 * @package CRM
 * @copyright CiviCRM LLC https://civicrm.org/licensing
 *
 * Generated from dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessor.xml
 * DO NOT EDIT.  Generated by CRM_Core_CodeGen
 * (GenCodeChecksum:213cb152fad35d4274a989aae622ed3c)
 */
use CRM_Dataprocessor_ExtensionUtil as E;

/**
 * Database access object for the DataProcessor entity.
 */
class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
  const EXT = E::LONG_NAME;
  const TABLE_ADDED = '';

  /**
   * Static instance to hold the table name.
   *
   * @var string
   */
  public static $_tableName = 'civicrm_data_processor';

  /**
   * Field to show when displaying a record.
   *
   * @var string
   */
  public static $_labelField = 'title';

  /**
   * Should CiviCRM log any modifications to this table in the civicrm_log table.
   *
   * @var bool
   */
  public static $_log = FALSE;

  /**
   * Unique DataProcessor ID
   *
   * @var int|string|null
   *   (SQL type: int unsigned)
   *   Note that values will be retrieved from the database as a string.
   */
  public $id;

  /**
   * @var string
   *   (SQL type: varchar(255))
   *   Note that values will be retrieved from the database as a string.
   */
  public $name;

  /**
   * @var string
   *   (SQL type: varchar(255))
   *   Note that values will be retrieved from the database as a string.
   */
  public $title;

  /**
   * @var string
   *   (SQL type: varchar(255))
   *   Note that values will be retrieved from the database as a string.
   */
  public $type;

  /**
   * @var string
   *   (SQL type: text)
   *   Note that values will be retrieved from the database as a string.
   */
  public $configuration;

  /**
   * @var bool|string
   *   (SQL type: tinyint)
   *   Note that values will be retrieved from the database as a string.
   */
  public $is_active;

  /**
   * @var string
   *   (SQL type: text)
   *   Note that values will be retrieved from the database as a string.
   */
  public $description;

  /**
   * @var string
   *   (SQL type: varchar(255))
   *   Note that values will be retrieved from the database as a string.
   */
  public $storage_type;

  /**
   * @var string
   *   (SQL type: text)
   *   Note that values will be retrieved from the database as a string.
   */
  public $storage_configuration;

  /**
   * @var int|string
   *   (SQL type: int unsigned)
   *   Note that values will be retrieved from the database as a string.
   */
  public $status;

  /**
   * @var string
   *   (SQL type: varchar(255))
   *   Note that values will be retrieved from the database as a string.
   */
  public $source_file;

  /**
   * Class constructor.
   */
  public function __construct() {
    $this->__table = 'civicrm_data_processor';
    parent::__construct();
  }

  /**
   * Returns localized title of this entity.
   *
   * @param bool $plural
   *   Whether to return the plural version of the title.
   */
  public static function getEntityTitle($plural = FALSE) {
    return $plural ? E::ts('Data Processors') : E::ts('Data Processor');
  }

  /**
   * Returns all the column names of this table
   *
   * @return array
   */
  public static function &fields() {
    if (!isset(Civi::$statics[__CLASS__]['fields'])) {
      Civi::$statics[__CLASS__]['fields'] = [
        'id' => [
          'name' => 'id',
          'type' => CRM_Utils_Type::T_INT,
          'title' => E::ts('ID'),
          'description' => E::ts('Unique DataProcessor ID'),
          'required' => TRUE,
          'where' => 'civicrm_data_processor.id',
          'table_name' => 'civicrm_data_processor',
          'entity' => 'DataProcessor',
          'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
          'localizable' => 0,
          'readonly' => TRUE,
          'add' => NULL,
        ],
        'name' => [
          'name' => 'name',
          'type' => CRM_Utils_Type::T_STRING,
          'title' => E::ts('Name'),
          'required' => FALSE,
          'maxlength' => 255,
          'size' => CRM_Utils_Type::HUGE,
          'where' => 'civicrm_data_processor.name',
          'table_name' => 'civicrm_data_processor',
          'entity' => 'DataProcessor',
          'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
          'localizable' => 0,
          'add' => NULL,
        ],
        'title' => [
          'name' => 'title',
          'type' => CRM_Utils_Type::T_STRING,
          'title' => E::ts('Title'),
          'required' => TRUE,
          'maxlength' => 255,
          'size' => CRM_Utils_Type::HUGE,
          'where' => 'civicrm_data_processor.title',
          'table_name' => 'civicrm_data_processor',
          'entity' => 'DataProcessor',
          'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
          'localizable' => 0,
          'add' => NULL,
        ],
        'type' => [
          'name' => 'type',
          'type' => CRM_Utils_Type::T_STRING,
          'title' => E::ts('Type'),
          'required' => TRUE,
          'maxlength' => 255,
          'size' => CRM_Utils_Type::HUGE,
          'where' => 'civicrm_data_processor.type',
          'table_name' => 'civicrm_data_processor',
          'entity' => 'DataProcessor',
          'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
          'localizable' => 0,
          'add' => NULL,
        ],
        'configuration' => [
          'name' => 'configuration',
          'type' => CRM_Utils_Type::T_TEXT,
          'title' => E::ts('Configuration'),
          'required' => FALSE,
          'where' => 'civicrm_data_processor.configuration',
          'table_name' => 'civicrm_data_processor',
          'entity' => 'DataProcessor',
          'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
          'localizable' => 0,
          'serialize' => self::SERIALIZE_JSON,
          'add' => NULL,
        ],
        'is_active' => [
          'name' => 'is_active',
          'type' => CRM_Utils_Type::T_BOOLEAN,
          'title' => E::ts('Is active'),
          'required' => TRUE,
          'where' => 'civicrm_data_processor.is_active',
          'table_name' => 'civicrm_data_processor',
          'entity' => 'DataProcessor',
          'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
          'localizable' => 0,
          'add' => NULL,
        ],
        'description' => [
          'name' => 'description',
          'type' => CRM_Utils_Type::T_TEXT,
          'title' => E::ts('Description'),
          'required' => FALSE,
          'where' => 'civicrm_data_processor.description',
          'table_name' => 'civicrm_data_processor',
          'entity' => 'DataProcessor',
          'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
          'localizable' => 0,
          'add' => NULL,
        ],
        'storage_type' => [
          'name' => 'storage_type',
          'type' => CRM_Utils_Type::T_STRING,
          'title' => E::ts('Storage Type'),
          'required' => FALSE,
          'maxlength' => 255,
          'size' => CRM_Utils_Type::HUGE,
          'where' => 'civicrm_data_processor.storage_type',
          'table_name' => 'civicrm_data_processor',
          'entity' => 'DataProcessor',
          'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
          'localizable' => 0,
          'add' => NULL,
        ],
        'storage_configuration' => [
          'name' => 'storage_configuration',
          'type' => CRM_Utils_Type::T_TEXT,
          'title' => E::ts('Storage Configuration'),
          'required' => FALSE,
          'where' => 'civicrm_data_processor.storage_configuration',
          'table_name' => 'civicrm_data_processor',
          'entity' => 'DataProcessor',
          'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
          'localizable' => 0,
          'serialize' => self::SERIALIZE_JSON,
          'add' => NULL,
        ],
        'status' => [
          'name' => 'status',
          'type' => CRM_Utils_Type::T_INT,
          'title' => E::ts('Status'),
          'required' => FALSE,
          'where' => 'civicrm_data_processor.status',
          'default' => '0',
          'table_name' => 'civicrm_data_processor',
          'entity' => 'DataProcessor',
          'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
          'localizable' => 0,
          'add' => NULL,
        ],
        'source_file' => [
          'name' => 'source_file',
          'type' => CRM_Utils_Type::T_STRING,
          'title' => E::ts('Source File'),
          'required' => FALSE,
          'maxlength' => 255,
          'size' => CRM_Utils_Type::HUGE,
          'where' => 'civicrm_data_processor.source_file',
          'table_name' => 'civicrm_data_processor',
          'entity' => 'DataProcessor',
          'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
          'localizable' => 0,
          'add' => NULL,
        ],
      ];
      CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
    }
    return Civi::$statics[__CLASS__]['fields'];
  }

  /**
   * Return a mapping from field-name to the corresponding key (as used in fields()).
   *
   * @return array
   *   Array(string $name => string $uniqueName).
   */
  public static function &fieldKeys() {
    if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
      Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
    }
    return Civi::$statics[__CLASS__]['fieldKeys'];
  }

  /**
   * Returns the names of this table
   *
   * @return string
   */
  public static function getTableName() {
    return self::$_tableName;
  }

  /**
   * Returns if this table needs to be logged
   *
   * @return bool
   */
  public function getLog() {
    return self::$_log;
  }

  /**
   * Returns the list of fields that can be imported
   *
   * @param bool $prefix
   *
   * @return array
   */
  public static function &import($prefix = FALSE) {
    $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'data_processor', $prefix, []);
    return $r;
  }

  /**
   * Returns the list of fields that can be exported
   *
   * @param bool $prefix
   *
   * @return array
   */
  public static function &export($prefix = FALSE) {
    $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'data_processor', $prefix, []);
    return $r;
  }

  /**
   * Returns the list of indices
   *
   * @param bool $localize
   *
   * @return array
   */
  public static function indices($localize = TRUE) {
    $indices = [];
    return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
  }

}
