# Path: wham/fields.py
# class WhamCharField(WhamFieldMixin, models.TextField):
# 
#     @property
#     def type_repr(self):
#         return 'char'
# 
# class WhamTextField(WhamFieldMixin, models.TextField):
# 
#     @property
#     def type_repr(self):
#         return 'text'
# 
# class WhamIntegerField(WhamFieldMixin, models.IntegerField):
# 
#     @property
#     def type_repr(self):
#         return 'integer'
# 
# class WhamManyToManyField(models.ManyToManyField):
# 
#     def __init__(self, *args, **kwargs):
#         self.wham_result_path = kwargs.pop('wham_result_path', None)
#         self.wham_endpoint = kwargs.pop('wham_endpoint', None)
#         self.wham_results_path = kwargs.pop('wham_results_path', ())
#         self.wham_pk_param = kwargs.pop('wham_pk_param', None)
#         self.wham_params = kwargs.pop('wham_params', {})
#         return super(WhamManyToManyField, self).__init__(*args, **kwargs)
# 
# 
# 
# 
#     @property
#     def type_repr(self):
#         return 'many to many'
# 
# Path: wham/models.py
# class WhamModel(models.Model):
# 
#     objects = WhamManager()
# 
#     class Meta():
#         abstract = True


from django.db import models
from wham.fields import WhamCharField, WhamTextField, WhamIntegerField, \
    WhamManyToManyField
from wham.models import WhamModel

# Create your models here.


class SpotifyMeta:
    base_url = 'https://api.spotify.com/v1/'


class SpotifyTrack(WhamModel):

    id = WhamCharField(max_length=255, primary_key=True)
    name = WhamTextField()

    href = WhamTextField(null=True)
    popularity = WhamIntegerField(null=True)
    track_number = WhamIntegerField(null=True)
    uri = WhamTextField(null=True)
    type = WhamTextField(null=True)
    preview_url = WhamTextField(null=True)

# Path: wham/fields.py
# class WhamCharField(WhamFieldMixin, models.TextField):
# 
#     @property
#     def type_repr(self):
#         return 'char'
# 
# class WhamTextField(WhamFieldMixin, models.TextField):
# 
#     @property
#     def type_repr(self):
#         return 'text'
# 
# class WhamIntegerField(WhamFieldMixin, models.IntegerField):
# 
#     @property
#     def type_repr(self):
#         return 'integer'
# 
# class WhamManyToManyField(models.ManyToManyField):
# 
#     def __init__(self, *args, **kwargs):
#         self.wham_result_path = kwargs.pop('wham_result_path', None)
#         self.wham_endpoint = kwargs.pop('wham_endpoint', None)
#         self.wham_results_path = kwargs.pop('wham_results_path', ())
#         self.wham_pk_param = kwargs.pop('wham_pk_param', None)
#         self.wham_params = kwargs.pop('wham_params', {})
#         return super(WhamManyToManyField, self).__init__(*args, **kwargs)
# 
# 
# 
# 
#     @property
#     def type_repr(self):
#         return 'many to many'
# 
# Path: wham/models.py
# class WhamModel(models.Model):
# 
#     objects = WhamManager()
# 
#     class Meta():
#         abstract = True


# Path: wham/apis/spotify/models.py
from django.db import models
from wham.fields import WhamCharField, WhamTextField, WhamIntegerField, \
    WhamManyToManyField
from wham.models import WhamModel


# Create your models here.


class SpotifyMeta:
    base_url = 'https://api.spotify.com/v1/'


class SpotifyTrack(WhamModel):

    id = WhamCharField(max_length=255, primary_key=True)
    name = WhamTextField()

    href = WhamTextField(null=True)
    popularity = WhamIntegerField(null=True)
    track_number = WhamIntegerField(null=True)
    uri = WhamTextField(null=True)
    type = WhamTextField(null=True)
    preview_url = WhamTextField(null=True)

    artists = WhamManyToManyField('SpotifyArtist', related_name='tracks')