// falukant/data/election.js
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';

class Election extends Model {}

Election.init({
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    autoIncrement: true},
  officeTypeId: {
    type: DataTypes.INTEGER,
    allowNull: true},
  regionId: {
    type: DataTypes.INTEGER,
    allowNull: false  
  },
  date: { 
    type: DataTypes.DATE,
    allowNull: false},
  postsToFill: {
    type: DataTypes.INTEGER,
    allowNull: false}}, {
  sequelize,
  modelName: 'Election',
  tableName: 'election',
  schema: 'falukant_data',
  timestamps: true,
  underscored: true});

export default Election;
