import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
import FalukantCharacter from './character.js';

class Relationship extends Model {}

Relationship.init(
  {
    character1Id: {
      type: DataTypes.INTEGER,
      allowNull: false},
    character2Id: {
      type: DataTypes.INTEGER,
      allowNull: false},
    relationshipTypeId: {
      type: DataTypes.INTEGER,
      allowNull: false,
      onDelete: 'CASCADE'},
    widowFirstName1: {
      type: DataTypes.STRING,
      allowNull: true},
    widowFirstName2: {
      type: DataTypes.STRING,
      allowNull: true},
    nextStepProgress: {
      type: DataTypes.INTEGER,
      allowNull: true,
      defaultValue: 0}},
  {
    sequelize,
    modelName: 'Relationship',
    tableName: 'relationship',
    schema: 'falukant_data',
    timestamps: true,
    underscored: true}
);

export default Relationship;
