<?xml version="1.0" encoding="UTF-8"?>
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">
  
  <module name="studio" package="com.axelor.studio.db" />
  
  <entity name="ActionBuilder" cacheable="true">
     <string name="name" title="Name" unique="true"/>
     <integer name="typeSelect" title="Type" selection="studio.action.builder.type.select" />
     <string name="model" title="Object" />
     <string name="targetModel"  title="Target object" />
     <one-to-many name="lines" ref="ActionBuilderLine" title="Fields" mappedBy="actionBuilder"/>
     <many-to-one name="assignValueTo" title="Assign value to" ref="com.axelor.meta.db.MetaField" />
     <string name="firstGroupBy" title="First group by"/>
     <string name="secondGroupBy" title="Second group by"/>
     <string name="title" title="Title" />
     <many-to-one name="emailTemplate" ref="com.axelor.apps.message.db.Template" title="Template" />
     <one-to-many name="filters" ref="Filter" title="Filters"/>
     <boolean name="transactional" title="Transactional" />
     <integer name="scriptType" title="Script type" selection="studio.action.builder.script.type.select"/>
     <string name="scriptText" title="Script" large="true"/>
     <boolean name="openRecord" title="Open record" />
     <string name="displayMsg" title="Display message" />
     <integer name="emailSendOptionSelect" title="Send option" selection="studio.action.builder.email.send.option.select"/>
     
     <!-- Action view fields -->
     <one-to-many name="actionBuilderViews" title="Views" ref="ActionBuilderView" mappedBy="actionBuilder" orderBy="sequence"/>
     <boolean name="isJson" title="Json" />

     <string name="domainCondition" title="Domain" />
     <one-to-many name="viewParams" title="View params" ref="ActionBuilderLine" orphanRemoval="true" />
     <boolean name="menuAction" />
     
     <many-to-one name="appBuilder" ref="AppBuilder" title="App builder" />
     
     <many-to-one name="metaModule" ref="com.axelor.meta.db.MetaModule" />
     
    <extra-code><![CDATA[
        public static final int TYPE_SELECT_CREATE = 0;
        public static final int TYPE_SELECT_UPDATE = 1;
        public static final int TYPE_SELECT_SCRIPT = 2;
        public static final int TYPE_SELECT_VIEW= 3;
        public static final int TYPE_SELECT_EMAIL = 4;
        public static final int TYPE_SELECT_REPORT = 5;
    ]]></extra-code>
     
  </entity>
  
</domain-models>
