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

const StoreSetting = sequelize.define('StoreSetting', {
    id: {
        type: DataTypes.INTEGER,
        primaryKey: true,
        autoIncrement: true
    },
    storeName: {
        type: DataTypes.STRING,
        defaultValue: 'Toko Buku Nalar'
    },
    email: {
        type: DataTypes.STRING,
        defaultValue: 'admin@nalar.com'
    },
    phone: {
        type: DataTypes.STRING,
        defaultValue: '+62 812 3456 7890'
    },
    address: {
        type: DataTypes.TEXT,
        defaultValue: 'Jakarta, Indonesia'
    },
    logo: {
        type: DataTypes.STRING,
        allowNull: true
    },
    favicon: {
        type: DataTypes.STRING,
        allowNull: true
    },
    qrisEnabled: {
        type: DataTypes.BOOLEAN,
        defaultValue: false
    },
    qrisImage: {
        type: DataTypes.STRING,
        allowNull: true
    },
    baseRate: {
        type: DataTypes.INTEGER,
        defaultValue: 10000
    },
    enableFreeShipping: {
        type: DataTypes.BOOLEAN,
        defaultValue: false
    },
    freeShippingThreshold: {
        type: DataTypes.INTEGER,
        defaultValue: 100000
    }
}, {
    tableName: 'store_settings',
    timestamps: true
});

module.exports = StoreSetting;
