<?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="base" package="com.axelor.apps.base.db"/>

  <entity name="Sequence" lang="java">

    <many-to-one name="company" title="Company" ref="com.axelor.apps.base.db.Company" required="false"/>
    <string name="name" title="Name" required="true"/>
    <string name="code" title="Document concerned" required="true" selection="sequence.generic.code.select"/>
    <enum name="sequenceTypeSelect" default="NUMBERS" ref="SequenceTypeSelect" title="Sequence type" required="true"/>
    <enum name="sequenceLettersTypeSelect" default="UPPERCASE" ref="SequenceLettersTypeSelect" title="Uppercase / lowercase"/>
    <string name="prefixe" title="Prefix"/>
    <string name="suffixe" title="Suffix"/>
    <integer name="padding" title="Padding" required="true"/>
    <integer name="toBeAdded" title="Increment" required="true" min="1"/>

    <boolean name="yearlyResetOk" title="Yearly reset"/>
    <boolean name="monthlyResetOk" title="Monthly reset"/>
    
    <one-to-many name="sequenceVersionList" ref="com.axelor.apps.base.db.SequenceVersion" mappedBy="sequence" title="Versions"/>

    <string name="fullName" title="Full name" namecolumn="true"/>
    
    <unique-constraint columns="company,code,prefixe,suffixe"/>
    <index columns="code,company" name="idx_sequence_code_company"/>
    <finder-method name="find" using="code,company"/>
    
     <extra-code><![CDATA[
        
        //SEQUENCE SELECT
        public static final String PARTNER = "partner";
        public static final String PRODUCT = "product";
        
     ]]></extra-code>
    
  </entity>

	<enum name="SequenceTypeSelect">
		<item name="NUMBERS" title="Use numbers"/>
		<item name="LETTERS" title="Use letters"/>
	</enum>

	<enum name="SequenceLettersTypeSelect">
		<item name="UPPERCASE" title="Use uppercases"/>
		<item name="LOWERCASE" title="Use lowercases"/>
	</enum>
</domain-models>