from django.db import models


class District(models.Model):
	district = models.CharField(max_length=50, unique=True, verbose_name='Район')

	class Meta:
		verbose_name = 'Район'
		verbose_name_plural = 'Районы'

	def __str__(self):
		return self.district


class Сategories(models.Model):
	сategories = models.CharField(max_length=50, unique=True, verbose_name='Катигории квартир')

	class Meta:
		verbose_name = 'Катигории квартир'
		verbose_name_plural = 'Катигории квартир'

	def __str__(self):
		return self.сategories


class Room(models.Model):
	name = models.CharField(max_length=50, unique=True, verbose_name='Обьект')
	created_at = models.DateTimeField(auto_now_add=True, verbose_name='Дата регистрации')
	updated_at = models.DateTimeField(auto_now=True, verbose_name='Дата Обновления')
	сategories = models.ForeignKey(Сategories, on_delete=models.CASCADE)
	district = models.ForeignKey(District, on_delete=models.CASCADE)
	old_price = models.DecimalField(decimal_places=2, max_digits=10, null=True, verbose_name='Старая цена')
	price = models.DecimalField(decimal_places=2, max_digits=10, blank=True, default=0.00, verbose_name='цена')

	#home_adress = models.CharField(max_length=100, unique=True, verbose_name='Полный адрес')
	House_number = models.IntegerField(verbose_name='Номер дома')
	entrance_number = models.IntegerField(verbose_name='Номер подьезда')
	apartment_number = models.IntegerField(verbose_name='Номер квартиры')
	total_floors = models.IntegerField(verbose_name='Этажей в доме')
	floor = models.IntegerField(verbose_name='Этаж')
	flat_area = models.IntegerField(verbose_name='Общая площадь')
	kitchen_area = models.IntegerField(verbose_name='Площадь кухни')
	living_space = models.TextField(verbose_name='Описание квартиры')
	is_active = models.BooleanField(default=True)
	image = models.ImageField(verbose_name='фото квартиры', upload_to='adminsite/static/adminsite/images/room',
							  default='', blank=False)

	class Meta:
		verbose_name = 'Квартиру'
		verbose_name_plural = 'Квартиры'

	def __str__(self):
		return self.name


# slug =models.SlugField(max_length=200,unique=True)
# author = models.CharField(max_length=200)
# publisher = models.CharField(max_length=200)
# quantity = models.IntegerField()
# meta_keywards = models.CharField("meta_keyward",max_length=255,help_text='Comma-delimited of SEO keywards for meta tag')


# meta_description = models.CharField("meta_description",max_length=255,help_text='content for meta tag')
# categories          =models.OneToManyField(category_name)


class Rent(models.Model):
	name = models.CharField(max_length=50, unique=True, verbose_name='Обьект')
	created_at = models.DateTimeField(auto_now_add=True, verbose_name='Дата регистрации')
	updated_at = models.DateTimeField(auto_now=True, verbose_name='Дата Обновления')
	old_price = models.DecimalField(decimal_places=2, max_digits=10, null=True, verbose_name='Старая цена')
	price = models.DecimalField(decimal_places=2, max_digits=10, blank=True, default=0.00, verbose_name='цена')
	home_adress = models.CharField(max_length=100, unique=True, verbose_name='Полный адрес')
	House_number = models.IntegerField(verbose_name='Номер дома')
	entrance_number = models.IntegerField(verbose_name='Номер подьезда')
	apartment_number = models.IntegerField(verbose_name='Номер квартиры')
	total_floors = models.IntegerField(verbose_name='Этажей в доме')
	floor = models.IntegerField(verbose_name='Этаж')
	flat_area = models.IntegerField(verbose_name='Общая площадь')
	kitchen_area = models.IntegerField(verbose_name='Площадь кухни')
	living_space = models.TextField(verbose_name='Описание квартиры')
	# slug               =models.SlugField(max_length=200,unique=True)
	# author = models.CharField(max_length=200)
	# publisher = models.CharField(max_length=200)
	is_active = models.BooleanField(default=True)

	# quantity = models.IntegerField()
	image = models.ImageField(verbose_name='фото квартиры', upload_to='adminsite/static/adminsite/images/rent',
							  default='', blank=False)

	class Meta:
		verbose_name = 'Аренду'
		verbose_name_plural = 'Аренды'

	def __str__(self):
		return self.name
