'use strict';

module.exports = {
  async up(queryInterface, Sequelize) {
    await queryInterface.createTable('workspace_settings', {
      id: { type: Sequelize.STRING(32), allowNull: false, primaryKey: true },
      practice_name: { type: Sequelize.TEXT },
      logo_url: { type: Sequelize.TEXT },
      coach_name: { type: Sequelize.TEXT },
      coach_photo_url: { type: Sequelize.TEXT },
      coach_bio: { type: Sequelize.TEXT },
      coach_credentials: { type: Sequelize.TEXT },
      coach_niche: { type: Sequelize.TEXT },
      brand_color: { type: Sequelize.STRING(16), allowNull: false, defaultValue: 'teal' },
      default_booking_url: { type: Sequelize.TEXT },
      contact_email: { type: Sequelize.TEXT },
      custom_domain: { type: Sequelize.TEXT },
      social_links: { type: Sequelize.JSONB, allowNull: false, defaultValue: [] },
      packages: { type: Sequelize.JSONB, allowNull: false, defaultValue: [] },
      testimonials: { type: Sequelize.JSONB, allowNull: false, defaultValue: [] },
      published: { type: Sequelize.BOOLEAN, allowNull: false, defaultValue: false },
      createdAt: { type: Sequelize.DATE, allowNull: false },
      updatedAt: { type: Sequelize.DATE, allowNull: false },
      updatedById: { type: Sequelize.UUID },
    });
    await queryInterface.bulkInsert('workspace_settings', [{
      id: 'default',
      brand_color: 'teal',
      social_links: JSON.stringify([]),
      packages: JSON.stringify([]),
      testimonials: JSON.stringify([]),
      published: false,
      createdAt: new Date(),
      updatedAt: new Date(),
    }]);
  },

  async down(queryInterface) {
    await queryInterface.dropTable('workspace_settings');
  },
};
