/* jshint indent: 2 */

module.exports = function (sequelize, DataTypes) {
    return sequelize.define('saasinvoiceapply', {
        id: {
            type: DataTypes.STRING,
            allowNull: false,
            primaryKey: true
        },
        saas_id: {
            type: DataTypes.STRING,
            allowNull: true
        },
        saas_merchant_id: {
            type: DataTypes.STRING,
            allowNull: true,
            defaultValue: ''
        },
        parent_id: {
            type: DataTypes.STRING,
            allowNull: true
        },
        batch_no: {
            type: DataTypes.STRING,
            allowNull: true
        },
        owner_type: {
            type: DataTypes.STRING,
            allowNull: true,
            defaultValue: '00'
        },
        fee_type: {
            type: DataTypes.STRING,
            allowNull: true,
            defaultValue: ''
        },
        invoice_type: {
            type: DataTypes.STRING,
            allowNull: true
        },
        invoice_amount: {
            type: DataTypes.BIGINT,
            allowNull: true,
            defaultValue: 0
        },
        status: {
            type: DataTypes.STRING,
            allowNull: true
        },
        audit_remark: {
            type: DataTypes.STRING,
            allowNull: true
        },
        sve_invoice_id: {
            type: DataTypes.STRING,
            allowNull: true,
            defaultValue: ''
        },
        apply_no: {
            type: DataTypes.STRING,
            allowNull: true
        },
        from_name: {
            type: DataTypes.STRING,
            allowNull: false
        },
        from_credit_code: {
            type: DataTypes.STRING,
            allowNull: false
        },
        from_addr: {
            type: DataTypes.STRING,
            allowNull: false
        },
        from_mobile: {
            type: DataTypes.STRING,
            allowNull: false
        },
        from_bank: {
            type: DataTypes.STRING,
            allowNull: false
        },
        from_account: {
            type: DataTypes.STRING,
            allowNull: false
        },
        to_name: {
            type: DataTypes.STRING,
            allowNull: false
        },
        to_credit_code: {
            type: DataTypes.STRING,
            allowNull: false
        },
        to_addr: {
            type: DataTypes.STRING,
            allowNull: false
        },
        to_mobile: {
            type: DataTypes.STRING,
            allowNull: false
        },
        to_bank: {
            type: DataTypes.STRING,
            allowNull: false
        },
        to_account: {
            type: DataTypes.STRING,
            allowNull: false
        },
        mail_to: {
            type: DataTypes.STRING,
            allowNull: true
        },
        mail_mobile: {
            type: DataTypes.STRING,
            allowNull: true
        },
        mail_addr: {
            type: DataTypes.STRING,
            allowNull: true
        },
        personal_invoice_tax: {
            type: DataTypes.INTEGER,
            allowNull: true
        },
        additional_tax: {
            type: DataTypes.BIGINT,
            allowNull: true
        },
        value_added_tax: {
            type: DataTypes.BIGINT,
            allowNull: true
        },
        service_tax: {
            type: DataTypes.BIGINT,
            allowNull: true
        },
        unit: {
            type: DataTypes.STRING,
            allowNull: true
        },
        quantity: {
            type: DataTypes.STRING,
            allowNull: true
        },
        price: {
            type: DataTypes.STRING,
            allowNull: true
        },
        remark: {
            type: DataTypes.STRING,
            allowNull: true
        },
        data_ids: {
            type: DataTypes.STRING,
            allowNull: true
        },
        pay_id: {
            type: DataTypes.STRING,
            allowNull: true
        },
        pay_voucher: {
            type: DataTypes.STRING,
            allowNull: true
        },
        created_at: {
            type: DataTypes.DATE,
            allowNull: false,
            defaultValue: DataTypes.NOW
        },
        updated_at: {
            type: DataTypes.DATE,
            allowNull: false,
            defaultValue: DataTypes.NOW
        },
        deleted_at: {
            type: DataTypes.DATE,
            allowNull: true
        },
        version: {
            type: DataTypes.INTEGER,
            allowNull: false,
            defaultValue: '0'
        }
    }, {
        timestamps: false,
        paranoid: true,
        version: true,
        tableName: 'saas_invoice_apply',
        comment: '发票申请列表',
    });
};
