# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-25 19:05
from __future__ import unicode_literals

from django.db import migrations

from geocoder.models import Provider as P


def create_providers(apps, schema_editor):
    Provider = apps.get_model("geocoder", "Provider")

    for vendor, limit in (
        (P.YANDEX, 25000), # https://tech.yandex.com/maps/doc/geocoder/desc/concepts/limits-docpage/
        (P.GOOGLE, 2500), # https://developers.google.com/maps/documentation/geocoding/usage-limits
        (P.OSM, 24 * 60 * 60), # https://operations.osmfoundation.org/policies/nominatim/
    ):
        Provider.objects.create(vendor=vendor, daily_request_limit=limit)


class Migration(migrations.Migration):

    dependencies = [
        ('geocoder', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(create_providers),
    ]
