const mongoose = require('mongoose');

const deploymentSchema = new mongoose.Schema({
  name: {
    type: String,
    required: true,
    trim: true
  },
  image: {
    type: String,
    required: true
  },
  status: {
    type: String,
    enum: ['pending', 'running', 'failed', 'completed'],
    default: 'pending'
  },
  createdBy: {
    type: String,
    required: true
  },
  createdAt: {
    type: Date,
    default: Date.now
  },
  env: [{
    key: String,
    value: String
  }],
  ports: [{
    container: Number,
    host: Number
  }],
  resources: {
    cpu: {
      type: Number,
      default: 1
    },
    memory: {
      type: Number,
      default: 512 // MB
    }
  }
});

module.exports = mongoose.model('Deployment', deploymentSchema); 