# Generated by Django 2.2 on 2020-11-27 13:01

import api_basebone.core.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Customer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, verbose_name='名字')),
                ('description', models.CharField(blank=True, max_length=1024, null=True, verbose_name='简介')),
                ('avatar', api_basebone.core.fields.BoneImageUrlField(blank=True, null=True, verbose_name='头像')),
                ('is_organization', models.BooleanField(default=False, verbose_name='是否机构')),
                ('org_name', models.CharField(blank=True, max_length=200, null=True, verbose_name='机构全称')),
                ('org_code', models.CharField(blank=True, max_length=200, null=True, verbose_name='机构代码')),
                ('phone', models.CharField(blank=True, max_length=20, null=True, verbose_name='电话')),
                ('address', models.CharField(blank=True, max_length=300, null=True, verbose_name='地址')),
                ('email', models.EmailField(blank=True, max_length=100, null=True, verbose_name='邮箱')),
                ('weixin', models.CharField(blank=True, max_length=100, null=True, verbose_name='微信号')),
                ('qq', models.CharField(blank=True, max_length=100, null=True, verbose_name='QQ号')),
                ('identity_code', models.CharField(blank=True, max_length=100, null=True, verbose_name='身份证号')),
                ('stage', models.CharField(choices=[('lead', '销售线索'), ('intention', '有意向'), ('trial', '试用'), ('paid', '付费'), ('repaid', '复购'), ('lost', '丢失')], default='', max_length=20, verbose_name='阶段')),
                ('source', models.CharField(choices=[('website', '网站'), ('wechat', '公众号'), ('recommand', '朋友推荐')], default='', max_length=100, verbose_name='渠道来源')),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, verbose_name='修改时间')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_customers', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('follwer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='following_customers', to=settings.AUTH_USER_MODEL, verbose_name='跟进人')),
                ('referrer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.LIGHTNING_CRM_CUSTOMER_MODEL, verbose_name='引荐客户')),
            ],
            options={
                'verbose_name': '客户',
                'verbose_name_plural': '客户',
                'abstract': False,
                'swappable': 'LIGHTNING_CRM_CUSTOMER_MODEL',
            },
        ),
        migrations.CreateModel(
            name='Contact',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.CharField(blank=True, max_length=1024, null=True, verbose_name='简介')),
                ('name', models.CharField(max_length=100, verbose_name='名字')),
                ('title', models.CharField(blank=True, max_length=100, null=True, verbose_name='职位')),
                ('avatar', api_basebone.core.fields.BoneImageUrlField(blank=True, null=True, verbose_name='头像')),
                ('phone', models.CharField(blank=True, max_length=20, null=True, verbose_name='电话')),
                ('address', models.CharField(blank=True, max_length=300, null=True, verbose_name='地址')),
                ('email', models.EmailField(blank=True, max_length=100, null=True, verbose_name='邮箱')),
                ('weixin', models.CharField(blank=True, max_length=100, null=True, verbose_name='微信号')),
                ('qq', models.CharField(blank=True, max_length=100, null=True, verbose_name='QQ号')),
                ('identity_code', models.CharField(blank=True, max_length=100, null=True, verbose_name='身份证号')),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('customer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.LIGHTNING_CRM_CUSTOMER_MODEL, verbose_name='客户')),
            ],
            options={
                'verbose_name': '联系人',
                'verbose_name_plural': '联系人',
            },
        ),
        migrations.CreateModel(
            name='Image',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('url', api_basebone.core.fields.BoneImageUrlField(verbose_name='链接')),
                ('name', models.CharField(blank=True, max_length=200, null=True, verbose_name='文件名')),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='上传时间')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='上传者')),
            ],
            options={
                'verbose_name': '图片',
                'verbose_name_plural': '图片',
            },
        ),
        migrations.CreateModel(
            name='FollowUp',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('action_type', models.CharField(choices=[('call', '打电话'), ('email', '发邮件'), ('wechat', '微信沟通'), ('visit', '拜访'), ('meetting', '会议')], default='', max_length=50, verbose_name='跟进类型')),
                ('content', models.TextField(blank=True, null=True, verbose_name='跟进内容')),
                ('follow_up_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('contacts', models.ManyToManyField(blank=True, to='lightning_crm.Contact', verbose_name='联系人')),
                ('customer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.LIGHTNING_CRM_CUSTOMER_MODEL, verbose_name='客户')),
                ('follow_up_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='跟进人')),
                ('images', models.ManyToManyField(blank=True, to='lightning_crm.Image', verbose_name='图片')),
            ],
            options={
                'verbose_name': '跟进',
                'verbose_name_plural': '跟进',
            },
        ),
    ]
