# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
#   * Rearrange models' order
#   * Make sure each model has one field with primary_key=True
#   * Make sure each ForeignKey has `on_delete` set to the desired behavior.
#   * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free to rename the models, but don't rename db_table values or field names.
from django.contrib.auth.models import User
from django.db import models


class AccountBanHistory(models.Model):
    account = models.ForeignKey('Accounts', models.DO_NOTHING)
    reason = models.CharField(max_length=255)
    banned_at = models.BigIntegerField()
    expired_at = models.BigIntegerField()
    banned_by = models.ForeignKey('Players', models.DO_NOTHING, db_column='banned_by')

    class Meta:
        managed = False
        db_table = 'account_ban_history'


class AccountBans(models.Model):
    account = models.OneToOneField('Accounts', models.DO_NOTHING, primary_key=True)
    reason = models.CharField(max_length=255)
    banned_at = models.BigIntegerField()
    expires_at = models.BigIntegerField()
    banned_by = models.ForeignKey('Players', models.DO_NOTHING, db_column='banned_by')

    class Meta:
        managed = False
        db_table = 'account_bans'


class AccountViplist(models.Model):
    account = models.ForeignKey('Accounts', models.DO_NOTHING)
    player = models.ForeignKey('Players', models.DO_NOTHING)
    description = models.CharField(max_length=128)
    icon = models.PositiveIntegerField()
    notify = models.IntegerField()

    class Meta:
        managed = False
        db_table = 'account_viplist'
        unique_together = (('account', 'player'),)


class Accounts(models.Model):
    name = models.CharField(unique=True, max_length=32)
    password = models.CharField(max_length=40)
    secret = models.CharField(max_length=16, blank=True, null=True)
    type = models.IntegerField(default=1)
    premdays = models.IntegerField(default=0)
    lastday = models.PositiveIntegerField(default=0)
    email = models.CharField(max_length=255)
    creation = models.IntegerField(default=0)
    linked_django_user = models.OneToOneField(User, on_delete=models.CASCADE, blank=True, null=True)

    class Meta:
        managed = True
        db_table = 'accounts'


class GuildInvites(models.Model):
    player = models.ForeignKey('Players', models.DO_NOTHING, primary_key=True)
    guild = models.ForeignKey('Guilds', models.DO_NOTHING)

    class Meta:
        managed = False
        db_table = 'guild_invites'
        unique_together = (('player', 'guild'),)


class GuildMembership(models.Model):
    player = models.ForeignKey('Players', models.DO_NOTHING, primary_key=True)
    guild = models.ForeignKey('Guilds', models.DO_NOTHING)
    rank = models.ForeignKey('GuildRanks', models.DO_NOTHING)
    nick = models.CharField(max_length=15)

    class Meta:
        managed = False
        db_table = 'guild_membership'


class GuildRanks(models.Model):
    guild = models.ForeignKey('Guilds', models.DO_NOTHING)
    name = models.CharField(max_length=255)
    level = models.IntegerField()

    class Meta:
        managed = False
        db_table = 'guild_ranks'


class GuildWars(models.Model):
    guild1 = models.IntegerField()
    guild2 = models.IntegerField()
    name1 = models.CharField(max_length=255)
    name2 = models.CharField(max_length=255)
    status = models.IntegerField()
    started = models.BigIntegerField()
    ended = models.BigIntegerField()

    class Meta:
        managed = False
        db_table = 'guild_wars'


class Guilds(models.Model):
    name = models.CharField(unique=True, max_length=255)
    ownerid = models.ForeignKey('Players', models.DO_NOTHING, db_column='ownerid', unique=True)
    creationdata = models.IntegerField()
    motd = models.CharField(max_length=255)

    class Meta:
        managed = False
        db_table = 'guilds'


class GuildwarKills(models.Model):
    killer = models.CharField(max_length=50)
    target = models.CharField(max_length=50)
    killerguild = models.IntegerField()
    targetguild = models.IntegerField()
    warid = models.ForeignKey(GuildWars, models.DO_NOTHING, db_column='warid')
    time = models.BigIntegerField()

    class Meta:
        managed = False
        db_table = 'guildwar_kills'


class HouseLists(models.Model):
    house = models.ForeignKey('Houses', models.DO_NOTHING)
    listid = models.IntegerField()
    list = models.TextField()

    class Meta:
        managed = False
        db_table = 'house_lists'


class Houses(models.Model):
    owner = models.IntegerField()
    paid = models.PositiveIntegerField()
    warnings = models.IntegerField()
    name = models.CharField(max_length=255)
    rent = models.IntegerField()
    town_id = models.IntegerField()
    bid = models.IntegerField()
    bid_end = models.IntegerField()
    last_bid = models.IntegerField()
    highest_bidder = models.IntegerField()
    size = models.IntegerField()
    beds = models.IntegerField()

    class Meta:
        managed = False
        db_table = 'houses'


class IpBans(models.Model):
    ip = models.PositiveIntegerField(primary_key=True)
    reason = models.CharField(max_length=255)
    banned_at = models.BigIntegerField()
    expires_at = models.BigIntegerField()
    banned_by = models.ForeignKey('Players', models.DO_NOTHING, db_column='banned_by')

    class Meta:
        managed = False
        db_table = 'ip_bans'


class MarketHistory(models.Model):
    player = models.ForeignKey('Players', models.DO_NOTHING)
    sale = models.IntegerField()
    itemtype = models.PositiveIntegerField()
    amount = models.PositiveSmallIntegerField()
    price = models.PositiveIntegerField()
    expires_at = models.BigIntegerField()
    inserted = models.BigIntegerField()
    state = models.PositiveIntegerField()

    class Meta:
        managed = False
        db_table = 'market_history'


class MarketOffers(models.Model):
    player = models.ForeignKey('Players', models.DO_NOTHING)
    sale = models.IntegerField()
    itemtype = models.PositiveIntegerField()
    amount = models.PositiveSmallIntegerField()
    created = models.BigIntegerField()
    anonymous = models.IntegerField()
    price = models.PositiveIntegerField()

    class Meta:
        managed = False
        db_table = 'market_offers'


class PlayerDeaths(models.Model):
    player = models.ForeignKey('Players', models.DO_NOTHING)
    time = models.BigIntegerField()
    level = models.IntegerField()
    killed_by = models.CharField(max_length=255)
    is_player = models.IntegerField()
    mostdamage_by = models.CharField(max_length=100)
    mostdamage_is_player = models.IntegerField()
    unjustified = models.IntegerField()
    mostdamage_unjustified = models.IntegerField()

    class Meta:
        managed = False
        db_table = 'player_deaths'


class PlayerDepotitems(models.Model):
    player = models.ForeignKey('Players', models.DO_NOTHING)
    sid = models.IntegerField()
    pid = models.IntegerField()
    itemtype = models.SmallIntegerField()
    count = models.SmallIntegerField()
    attributes = models.TextField()

    class Meta:
        managed = False
        db_table = 'player_depotitems'
        unique_together = (('player', 'sid'),)


class PlayerInboxitems(models.Model):
    player = models.ForeignKey('Players', models.DO_NOTHING)
    sid = models.IntegerField()
    pid = models.IntegerField()
    itemtype = models.SmallIntegerField()
    count = models.SmallIntegerField()
    attributes = models.TextField()

    class Meta:
        managed = False
        db_table = 'player_inboxitems'
        unique_together = (('player', 'sid'),)


class PlayerItems(models.Model):
    player = models.ForeignKey('Players', models.DO_NOTHING)
    pid = models.IntegerField()
    sid = models.IntegerField()
    itemtype = models.SmallIntegerField()
    count = models.SmallIntegerField()
    attributes = models.TextField()

    class Meta:
        managed = False
        db_table = 'player_items'


class PlayerNamelocks(models.Model):
    player = models.ForeignKey('Players', models.DO_NOTHING, primary_key=True)
    reason = models.CharField(max_length=255)
    namelocked_at = models.BigIntegerField()
    namelocked_by = models.ForeignKey('Players', models.DO_NOTHING, db_column='namelocked_by', related_name='namelocks')

    class Meta:
        managed = False
        db_table = 'player_namelocks'


class PlayerSpells(models.Model):
    player = models.ForeignKey('Players', models.DO_NOTHING)
    name = models.CharField(max_length=255)

    class Meta:
        managed = False
        db_table = 'player_spells'


class PlayerStorage(models.Model):
    player = models.ForeignKey('Players', models.DO_NOTHING, primary_key=True)
    key = models.PositiveIntegerField()
    value = models.IntegerField()

    class Meta:
        managed = False
        db_table = 'player_storage'
        unique_together = (('player', 'key'),)


class Players(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(unique=True, max_length=255)
    group_id = models.IntegerField(default=1)
    account = models.ForeignKey(Accounts, models.DO_NOTHING, default=1)
    level = models.IntegerField(default=1)
    vocation = models.IntegerField(default=0)
    health = models.IntegerField(default=150)
    healthmax = models.IntegerField(default=150)
    experience = models.BigIntegerField(default=0)
    lookbody = models.IntegerField(default=0)
    lookfeet = models.IntegerField(default=0)
    lookhead = models.IntegerField(default=0)
    looklegs = models.IntegerField(default=0)
    looktype = models.IntegerField(default=136)
    lookaddons = models.IntegerField(default=0)
    maglevel = models.IntegerField(default=1)
    mana = models.IntegerField(default=55)
    manamax = models.IntegerField(default=55)
    manaspent = models.PositiveIntegerField(default=0)
    soul = models.PositiveIntegerField(default=0)
    town_id = models.IntegerField(default=1)
    posx = models.IntegerField()
    posy = models.IntegerField()
    posz = models.IntegerField()
    conditions = models.TextField(blank=True, null=True, default='')
    cap = models.IntegerField(default=400)
    sex = models.IntegerField(default=0)
    lastlogin = models.BigIntegerField(default=0)
    lastip = models.PositiveIntegerField(default=0)
    tibia_save = models.IntegerField(default=1, db_column='save')
    skull = models.IntegerField(default=0)
    skulltime = models.IntegerField(default=0)
    lastlogout = models.BigIntegerField(default=0)
    blessings = models.IntegerField(default=0)
    onlinetime = models.IntegerField(default=0)
    deletion = models.BigIntegerField(default=0)
    balance = models.BigIntegerField(default=0)
    offlinetraining_time = models.PositiveSmallIntegerField(default=43200)
    offlinetraining_skill = models.IntegerField(default=-1)
    stamina = models.PositiveSmallIntegerField(default=2520)
    skill_fist = models.PositiveIntegerField(default=10)
    skill_fist_tries = models.BigIntegerField(default=0)
    skill_club = models.PositiveIntegerField(default=10)
    skill_club_tries = models.BigIntegerField(default=0)
    skill_sword = models.PositiveIntegerField(default=10)
    skill_sword_tries = models.BigIntegerField(default=0)
    skill_axe = models.PositiveIntegerField(default=10)
    skill_axe_tries = models.BigIntegerField(default=0)
    skill_dist = models.PositiveIntegerField(default=10)
    skill_dist_tries = models.BigIntegerField(default=0)
    skill_shielding = models.PositiveIntegerField(default=10)
    skill_shielding_tries = models.BigIntegerField(default=0)
    skill_fishing = models.PositiveIntegerField(default=10)
    skill_fishing_tries = models.BigIntegerField(default=0)

    class Meta:
        managed = True
        db_table = 'players'


class PlayersOnline(models.Model):
    player_id = models.IntegerField(primary_key=True)

    class Meta:
        managed = False
        db_table = 'players_online'


class ServerConfig(models.Model):
    config = models.CharField(primary_key=True, max_length=50)
    value = models.CharField(max_length=256)

    class Meta:
        managed = False
        db_table = 'server_config'


class TileStore(models.Model):
    house = models.ForeignKey(Houses, models.DO_NOTHING)
    data = models.TextField()

    class Meta:
        managed = False
        db_table = 'tile_store'


class Towns(models.Model):
    name = models.CharField(unique=True, max_length=255)
    posx = models.IntegerField()
    posy = models.IntegerField()
    posz = models.IntegerField()

    class Meta:
        managed = False
        db_table = 'towns'
