
import {
    DataTypes
} from 'sequelize';

import {
    DBLogger,
    LabelDB
} from './db_conn.mjs'

import {
    Medium
} from "./media.model.mjs";

export const Printer = LabelDB.define('printer', {
    id: {
        type: DataTypes.UUID,
        defaultValue: DataTypes.UUIDV4,
        primaryKey: true
    },
    name: {
        type: DataTypes.STRING,
        allowNull: false
    },
    type: {
        type: DataTypes.ENUM,
        values: [
            'zpl'
        ],
        allowNull: false
    },
    density: {
        type: DataTypes.INTEGER,
        allowNull: false
    },
    socket_addr: {
        type: DataTypes.STRING,
        allowNull: false
    },
    socket_port: {
        type: DataTypes.INTEGER,
        allowNull: false
    }
}, {
    timestamps: false
});

Medium.hasMany(Printer);
Printer.belongsTo(Medium);
