from django.contrib.auth.models import Permission, User
from django.db import models

class Album(models.Model):

    user = models.ForeignKey(User, default=1,on_delete=models.CASCADE)
    artist = models.CharField(max_length=250)
    album_title = models.CharField(max_length=500)
    genre = models.CharField(max_length=100)
    album_logo = models.FileField(default="avatar.jpg")
    album_visibility = models.CharField(max_length=100, default="private")
    is_favorite = models.BooleanField(default=False)

    def __str__(self):
        return self.album_title + '-' + self.artist + '-' + self.genre


class Song(models.Model):

    user = models.ForeignKey(User, default=1,on_delete=models.CASCADE)
    album = models.ForeignKey(Album, on_delete=models.CASCADE, null=True)
    song_title = models.CharField(max_length=250)
    audio_file = models.FileField(default='')
    song_visibility = models.CharField(max_length=100, default="private")
    is_favorite = models.BooleanField(default=False)

    def __str__(self):
        return self.song_title 
[(6, 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'default': '(1)', 'on_delete': 'models.CASCADE'}), False, 'from django.db import models\n'), (7, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(250)'}), False, 'from django.db import models\n'), (8, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(500)'}), False, 'from django.db import models\n'), (9, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), False, 'from django.db import models\n'), (10, 'django.db.models.FileField', 'models.FileField', ([], {'default': '"""avatar.jpg"""'}), False, 'from django.db import models\n'), (11, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'default': '"""private"""'}), False, 'from django.db import models\n'), (12, 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), False, 'from django.db import models\n'), (20, 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'default': '(1)', 'on_delete': 'models.CASCADE'}), False, 'from django.db import models\n'), (21, 'django.db.models.ForeignKey', 'models.ForeignKey', (['Album'], {'on_delete': 'models.CASCADE', 'null': '(True)'}), False, 'from django.db import models\n'), (22, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(250)'}), False, 'from django.db import models\n'), (23, 'django.db.models.FileField', 'models.FileField', ([], {'default': '""""""'}), False, 'from django.db import models\n'), (24, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'default': '"""private"""'}), False, 'from django.db import models\n'), (25, 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), False, 'from django.db import models\n')]