import { DataTypes } from 'sequelize';
import sequelize from '../database.js';

const BillingDocumentValue = sequelize.define('BillingDocumentValue', {
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    autoIncrement: true,
    allowNull: false
  },
  billingDocumentId: {
    type: DataTypes.INTEGER,
    allowNull: false,
    field: 'billing_document_id'
  },
  fieldKey: {
    type: DataTypes.STRING(120),
    allowNull: false,
    field: 'field_key'
  },
  resolvedValue: {
    type: DataTypes.TEXT,
    allowNull: true,
    field: 'resolved_value'
  },
  resolvedSource: {
    type: DataTypes.STRING(255),
    allowNull: true,
    field: 'resolved_source'
  }
}, {
  tableName: 'billing_document_value',
  underscored: true,
  timestamps: false
});

export default BillingDocumentValue;
