<?xml version="1.0" encoding="iso-8859-1" ?>
<table>
  <base>CRM/Campaign</base>
  <class>Survey</class>
  <name>civicrm_survey</name>
  <comment>Campaign Survey Details.</comment>
  <add>3.2</add>
  <icon>fa-clipboard</icon>
  <labelField>title</labelField>
  <component>CiviCampaign</component>
  <paths>
    <add>civicrm/survey/add?reset=1</add>
    <update>civicrm/survey/configure/main?reset=1&amp;action=update&amp;id=[id]</update>
    <delete>civicrm/survey/delete?reset=1&amp;id=[id]</delete>
  </paths>
  <field>
    <name>id</name>
    <title>Survey ID</title>
    <type>int unsigned</type>
    <required>true</required>
    <comment>Survey id.</comment>
    <html>
      <type>Number</type>
    </html>
    <add>3.3</add>
  </field>
  <primaryKey>
    <name>id</name>
    <autoincrement>true</autoincrement>
  </primaryKey>

  <field>
      <name>title</name>
      <title>Survey Title</title>
      <type>varchar</type>
      <length>255</length>
      <required>true</required>
      <localizable>true</localizable>
      <comment>Title of the Survey.</comment>
      <html>
        <type>Text</type>
      </html>
      <import>true</import>
      <add>3.3</add>
  </field>

  <field>
    <name>campaign_id</name>
    <title>Campaign ID</title>
    <type>int unsigned</type>
    <default>NULL</default>
    <comment>Foreign key to the Campaign.</comment>
    <html>
      <type>EntityRef</type>
      <label>Campaign</label>
    </html>
    <add>3.3</add>
    <pseudoconstant>
      <table>civicrm_campaign</table>
      <keyColumn>id</keyColumn>
      <labelColumn>title</labelColumn>
      <prefetch>disabled</prefetch>
    </pseudoconstant>
  </field>
  <foreignKey>
    <name>campaign_id</name>
    <table>civicrm_campaign</table>
    <key>id</key>
    <add>3.3</add>
    <onDelete>SET NULL</onDelete>
  </foreignKey>

  <field>
    <name>activity_type_id</name>
    <title>Activity Type</title>
    <type>int unsigned</type>
    <default>NULL</default>
    <comment>Implicit FK to civicrm_option_value where option_group = activity_type</comment>
    <import>true</import>
    <add>3.3</add>
    <pseudoconstant>
      <optionGroupName>activity_type</optionGroupName>
    </pseudoconstant>
    <html>
      <type>Select</type>
    </html>
  </field>
  <index>
    <name>UI_activity_type_id</name>
    <fieldName>activity_type_id</fieldName>
    <add>3.3</add>
  </index>

  <field>
    <name>recontact_interval</name>
    <title>Follow up Interval</title>
    <type>text</type>
    <comment>Recontact intervals for each status.</comment>
    <add>3.3</add>
    <drop>5.66</drop>
  </field>

  <field>
    <name>instructions</name>
    <title>Instructions</title>
    <type>text</type>
    <localizable>true</localizable>
    <comment>Script instructions for volunteers to use for the survey.</comment>
    <html>
      <type>RichTextEditor</type>
      <rows>20</rows>
      <cols>80</cols>
    </html>
    <add>3.3</add>
  </field>

  <field>
    <name>release_frequency</name>
    <title>Survey Hold Duration</title>
    <type>int unsigned</type>
    <default>NULL</default>
    <comment>Number of days for recurrence of release.</comment>
    <add>3.3</add>
  </field>

  <field>
    <name>max_number_of_contacts</name>
    <title>Maximum number of contacts</title>
    <type>int unsigned</type>
    <default>NULL</default>
    <comment>Maximum number of contacts to allow for survey.</comment>
    <add>3.3</add>
  </field>

  <field>
    <name>default_number_of_contacts</name>
    <title>Default number of contacts</title>
    <type>int unsigned</type>
    <default>NULL</default>
    <comment>Default number of contacts to allow for survey.</comment>
    <add>3.3</add>
  </field>

  <field>
    <name>is_active</name>
    <title>Survey Is Active</title>
    <type>boolean</type>
    <default>1</default>
    <required>true</required>
    <html>
      <type>CheckBox</type>
      <label>Enabled</label>
    </html>
    <comment>Is this survey enabled or disabled/cancelled?</comment>
    <add>3.3</add>
  </field>

  <field>
    <name>is_default</name>
    <title>Is Default Survey</title>
    <type>boolean</type>
    <default>0</default>
    <required>true</required>
    <html>
      <type>CheckBox</type>
      <label>Default</label>
    </html>
    <comment>Is this default survey?</comment>
    <add>3.3</add>
  </field>

  <field>
    <name>created_id</name>
    <title>Created By Contact ID</title>
    <type>int unsigned</type>
    <comment>FK to civicrm_contact, who created this Survey.</comment>
    <html>
      <label>Created By</label>
    </html>
    <add>3.3</add>
  </field>
  <foreignKey>
    <name>created_id</name>
    <table>civicrm_contact</table>
    <key>id</key>
    <add>3.3</add>
    <onDelete>SET NULL</onDelete>
  </foreignKey>

  <field>
    <name>created_date</name>
    <type>datetime</type>
    <title>Campaign Created Date</title>
    <comment>Date and time that Survey was created.</comment>
    <add>3.3</add>
  </field>

  <field>
    <name>last_modified_id</name>
    <title>Modified By Contact ID</title>
    <type>int unsigned</type>
    <comment>FK to civicrm_contact, who recently edited this Survey.</comment>
    <html>
      <label>Modified By</label>
    </html>
    <add>3.3</add>
  </field>
  <foreignKey>
    <name>last_modified_id</name>
    <table>civicrm_contact</table>
    <key>id</key>
    <add>3.3</add>
    <onDelete>SET NULL</onDelete>
  </foreignKey>

  <field>
    <name>last_modified_date</name>
    <title>Survey Modified On</title>
    <type>datetime</type>
    <comment>Date and time that Survey was edited last time.</comment>
    <add>3.3</add>
  </field>

  <field>
    <name>result_id</name>
    <title>Survey Result</title>
    <type>int unsigned</type>
    <default>NULL</default>
    <comment>Used to store option group id.</comment>
    <add>3.3</add>
    <pseudoconstant>
      <table>civicrm_option_group</table>
      <keyColumn>id</keyColumn>
      <labelColumn>title</labelColumn>
      <nameColumn>name</nameColumn>
      <condition>name LIKE "civicrm_survey_%"</condition>
    </pseudoconstant>
  </field>
  <field>
    <name>bypass_confirm</name>
    <title>No Email Verification</title>
    <type>boolean</type>
    <default>0</default>
    <required>true</required>
    <comment>Bypass the email verification.</comment>
    <add>4.2</add>
  </field>
  <field>
    <name>thankyou_title</name>
    <title>Thank-you Title</title>
    <type>varchar</type>
    <length>255</length>
    <localizable>true</localizable>
    <comment>Title for Thank-you page (header title tag, and display at the top of the page).</comment>
    <add>4.2</add>
  </field>
  <field>
    <name>thankyou_text</name>
    <title>Thank-you Text</title>
    <type>text</type>
    <html>
      <type>TextArea</type>
      <rows>8</rows>
      <cols>60</cols>
    </html>
    <localizable>true</localizable>
    <comment>text and html allowed. displayed above result on success page</comment>
    <add>4.2</add>
  </field>
  <field>
    <name>is_share</name>
    <title>Is shared through social media</title>
    <type>boolean</type>
    <default>1</default>
    <required>true</required>
    <comment>Can people share the petition through social media?</comment>
    <add>4.4</add>
  </field>
</table>
