<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="com.arrebol.taxiservicios.model.stocktaking.Invoice" table="INVOICE" catalog="crov_inmobiliaria">
        <id name="id" type="string">
            <column name="id" length="36" />
            <generator class="assigned"></generator>
        </id>
        <property name="folio" type="string" not-null="true">
            <column name="folio" length="50" />
        </property>
        <property name="buyDate" type="date" not-null="true">
            <column name="buy_date" length="10" />
        </property>
        <property name="comment" type="string">
            <column name="comment" length="250" />
        </property>
        <property name="subtotal" type="float" not-null="true">
            <column name="subtotal"/>
        </property>
        <property name="iva" type="float" not-null="true">
            <column name="iva"/>
        </property>
        <property name="total" type="float" not-null="true">
            <column name="total"/>
        </property>
        <property name="statusType" column="status_type" not-null="true">
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">com.arrebol.taxiservicios.model.enums.StatusType</param>
                <param name="useNamed">true</param>
            </type>
        </property>
        <many-to-one class="com.arrebol.taxiservicios.model.admin.Taxi" fetch="select" name="taxi">
            <column length="36" name="taxi_id"/>
        </many-to-one>
        <property name="active" type="java.lang.Boolean">
            <column name="active" sql-type="TINYINT" not-null="true"/>
        </property>
        <many-to-one name="person" class="com.arrebol.taxiservicios.model.core.Person" fetch="select">
            <column name="provider_id" length="36" not-null="true" />
        </many-to-one>
        <many-to-one name="driver" class="com.arrebol.taxiservicios.model.core.Person" fetch="select">
            <column name="driver_id" length="36"/>
        </many-to-one>
        <many-to-one class="com.arrebol.taxiservicios.model.catalog.Location" fetch="select" name="location">
            <column length="36" name="id_location" not-null="false"/>
        </many-to-one>
        <many-to-one class="com.arrebol.taxiservicios.model.catalog.Location" fetch="select" name="locationSend">
            <column length="36" name="id_location_send" not-null="false"/>
        </many-to-one>
        <many-to-one name="createdBy" class="com.arrebol.taxiservicios.model.core.User" not-null="true" fetch="select">
            <column name="created_by" length="36"/>
        </many-to-one>
        <property name="createdOn" type="timestamp">
            <column length="19" name="created_on"/>
        </property>
        <many-to-one name="lastUpdatedBy" class="com.arrebol.taxiservicios.model.core.User" fetch="select">
            <column name="last_updated_by" length="36"/>
        </many-to-one>
        <property name="lastUpdatedOn" type="timestamp">
            <column length="19" name="last_updated_on" />
        </property>
        <property name="paid" column="paid" not-null="true">
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">com.arrebol.taxiservicios.model.enums.BasicType</param>
                <param name="useNamed">true</param>
            </type>
        </property> 
        <property name="authorize" column="authorize" not-null="true">
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">com.arrebol.taxiservicios.model.enums.StatusType</param>
                <param name="useNamed">true</param>
            </type>
        </property>  
        <many-to-one class="com.arrebol.taxiservicios.model.catalog.BankCard" fetch="select" name="bankCard">
            <column length="36" name="id_bank_card" not-null="false"/>
        </many-to-one>
        
        <property name="depositStatus" column="deposit_status" not-null="true">
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">com.arrebol.taxiservicios.model.enums.ExpenseStatusType</param>
                <param name="useNamed">true</param>
            </type>
        </property>
        <set name="invoiceHasProducts" table="INVOICE_HAS_PRODUCT" inverse="true" lazy="true" fetch="select">
            <key>
                <column name="invoice_id" length="36" not-null="true" />
            </key>
            <one-to-many class="com.arrebol.taxiservicios.model.stocktaking.InvoiceHasProduct" />
        </set>
        <set name="productInvoiceBks" table="PRODUCT_INVOICE_BK" inverse="true" lazy="true" fetch="select">
            <key>
                <column name="invoice_id" length="36" not-null="true" />
            </key>
            <one-to-many class="com.arrebol.taxiservicios.model.stocktaking.ProductInvoiceBk" />
        </set>
    </class>
</hibernate-mapping>