<?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.ServiceOrder" table="service_order" catalog="prase">
        <id name="id" type="string">
            <column name="id" length="36" />
            <generator class="assigned"></generator>
        </id>
        <property name="name" type="string" not-null="true">
            <column name="name" length="14" />
        </property>
        <property name="nameNumber" type="int" not-null="true">
            <column name="name_number"/>
        </property>
        <property name="km" type="float">
            <column name="km"/>
        </property>
        <property name="kmMaintenance" type="float">
            <column name="km_maintenance"/>
        </property>
        <property name="subtotal" type="float">
            <column name="subtotal"/>
        </property>
        <property name="iva" type="float">
            <column name="iva"/>
        </property>
        <property name="total" type="float">
            <column name="total"/>
        </property>
        <property name="serviceOrderType" column="service_order_type" not-null="true">
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">com.arrebol.taxiservicios.model.enums.ServiceOrderType</param>
                <param name="useNamed">true</param>
            </type>
        </property>
        <property name="paymentMethodType" column="payment_method_type" not-null="true">
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">com.arrebol.taxiservicios.model.enums.PaymentMethodType</param>
                <param name="useNamed">true</param>
            </type>
        </property>
        <property name="tallerExterno" column="taller_externo" 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="active" type="java.lang.Boolean">
            <column name="active" sql-type="TINYINT" not-null="true"/>
        </property>
        <property name="paseTallerDate" type="timestamp">
            <column length="19" name="pase_taller_date"/>
        </property>
        <property name="pendingDate" type="timestamp">
            <column length="19" name="pending_date"/>
        </property>
        <property name="approvateDate" type="timestamp">
            <column length="19" name="approved_date"/>
        </property>
        <property name="progressDate" type="timestamp">
            <column length="19" name="progress_date"/>
        </property>
        <property name="finishDate" type="timestamp">
            <column length="19" name="finish_date"/>
        </property>
        <property name="description" type="string">
            <column name="description" length="200" />
        </property>
        <many-to-one name="taxi" class="com.arrebol.taxiservicios.model.admin.Taxi" not-null="true" fetch="select">
            <column name="taxi_id" length="36"/>
        </many-to-one>
        <many-to-one name="generalPublic" class="com.arrebol.taxiservicios.model.admin.GeneralPublic" fetch="select">
            <column name="general_public_id" length="36"/>
        </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>
        
        <many-to-one name="paseTallerUser" class="com.arrebol.taxiservicios.model.core.User" not-null="true" fetch="select">
            <column name="pase_taller_user" length="36"/>
        </many-to-one>
        <many-to-one name="pendienteUser" class="com.arrebol.taxiservicios.model.core.User" not-null="true" fetch="select">
            <column name="pendiente_user" length="36"/>
        </many-to-one>
        <many-to-one name="aprobadoUser" class="com.arrebol.taxiservicios.model.core.User" not-null="true" fetch="select">
            <column name="aprobado_user" length="36"/>
        </many-to-one>
        <many-to-one name="progresoUser" class="com.arrebol.taxiservicios.model.core.User" not-null="true" fetch="select">
            <column name="progreso_user" length="36"/>
        </many-to-one>
        <many-to-one name="terminadoUser" class="com.arrebol.taxiservicios.model.core.User" not-null="true" fetch="select">
            <column name="terminado_user" length="36"/>
        </many-to-one>
        <many-to-one name="payUser" class="com.arrebol.taxiservicios.model.core.User"  fetch="select">
            <column name="pay_user" length="36"/>
        </many-to-one>
        <property name="payDate" type="timestamp">
            <column length="19" name="pay_date"/>
        </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="serviceOrderHasProducts" table="SERVICE_ORDER_HAS_PRODUCT" inverse="true" lazy="true" fetch="select">
            <key>
                <column name="service_order_id" length="36" not-null="true" />
            </key>
            <one-to-many class="com.arrebol.taxiservicios.model.stocktaking.ServiceOrderHasProduct" />
        </set>
    </class>
</hibernate-mapping>