from django.db import models
from design_data.models import *

# Create your models here.
class Yarn(models.Model):
    name = models.CharField(max_length=25, null=True)
    code = models.CharField(max_length=25, null=True)
    type = models.CharField(max_length=25, null=True)
    maker = models.CharField(max_length=25, null=True)
    count = models.IntegerField(null=True)
    filament = models.IntegerField(null=True)
    contraction = models.IntegerField(null=True)
    material = models.CharField(max_length=10, null=True)
    kind = models.CharField(max_length=25, null=True)
    color = models.CharField(max_length=25, null=True)
    qty = models.IntegerField(default=0)

    class Meta:
        db_table = 'Fabric_Yarn'


class Beam(models.Model):
    name = models.CharField(max_length=25, null=True)
    yarn = models.ForeignKey(Yarn, on_delete=models.CASCADE, null=True)
    yarn_qty = models.IntegerField(default=0)
    size = models.IntegerField(null=True)

    class Meta:
        db_table = 'Fabric_Beam'


class Raw(models.Model):
    designData_id = models.ForeignKey(FSTY_CAD_Design_Data, on_delete=models.CASCADE)
    qty = models.IntegerField(default=0)

    class Meta:
        db_table = 'Fabric_Raw'


class RawRoll(models.Model):
    raw_id = models.ForeignKey(Raw, on_delete=models.CASCADE)
    raw_qty = models.IntegerField(default=0)