const { DataTypes } = require('sequelize');
const { sequelize } = require('../config/db');

const Pet = sequelize.define('Pet', {
  id: {
    type: DataTypes.INTEGER,
    autoIncrement: true,
    primaryKey: true,
  },
  userId: {
    type: DataTypes.INTEGER,
    allowNull: false,
    comment: 'Reference to User table',
  },
  name: {
    type: DataTypes.STRING,
    allowNull: false,
  },
  species: {
    type: DataTypes.STRING,
    allowNull: false,
    comment: 'Species Name (e.g. 강아지)',
  },
  breed: {
    type: DataTypes.STRING,
    allowNull: false,
    comment: 'Breed Name (e.g. 말티즈)',
  },
  gender: {
    type: DataTypes.STRING,
    allowNull: false,
    comment: '남아, 여아, 기타',
  },
  isNeutered: {
    type: DataTypes.BOOLEAN,
    defaultValue: false,
  },
  birthDate: {
    type: DataTypes.DATEONLY,
    allowNull: true,
  },
  isDateUnknown: {
    type: DataTypes.BOOLEAN,
    defaultValue: false,
  },
  weight: {
    type: DataTypes.FLOAT,
    allowNull: true,
  },
  registrationNumber: {
    type: DataTypes.STRING,
    allowNull: true,
  },
  profileImagePath: {
    type: DataTypes.STRING,
    allowNull: true,
    comment: 'Relative path to uploaded image',
  },
  diseases: {
    type: DataTypes.TEXT,
    allowNull: true,
    comment: 'JSON string of current diseases',
  },
  pastDiseases: {
    type: DataTypes.TEXT,
    allowNull: true,
    comment: 'JSON string of past diseases',
  },
  healthConcerns: {
    type: DataTypes.TEXT,
    allowNull: true,
    comment: 'JSON string of health concerns',
  },
}, {
  timestamps: true,
});

module.exports = Pet;
