from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('jituan', '0010_club_huiyuan_bundle_include'),
    ]

    operations = [
        migrations.CreateModel(
            name='ClubPaymentChannel',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('club_id', models.CharField(db_index=True, max_length=16, verbose_name='俱乐部ID')),
                ('channel', models.CharField(
                    choices=[
                        ('wechat_jsapi', '微信直连-小程序JSAPI'),
                        ('wechat_v3', '微信直连-V3转账/退款'),
                        ('alipay_wap', '支付宝-手机网站'),
                        ('fubei_wx_mini', '付呗-微信小程序'),
                    ],
                    db_index=True,
                    max_length=32,
                )),
                ('name', models.CharField(help_text='如：主付呗、备用微信', max_length=64, verbose_name='配置名称')),
                ('enabled', models.IntegerField(default=1, verbose_name='1启用0停用')),
                ('is_default', models.BooleanField(default=True, verbose_name='同通道默认配置')),
                ('sort_order', models.IntegerField(default=0, verbose_name='前端展示顺序')),
                ('sandbox', models.BooleanField(default=False, verbose_name='沙箱/联调')),
                ('app_id', models.CharField(blank=True, default='', max_length=64, verbose_name='AppID/付呗ID')),
                ('mch_id', models.CharField(blank=True, default='', max_length=64, verbose_name='商户号')),
                ('api_key_enc', models.TextField(blank=True, default='', verbose_name='API密钥/付呗Secret(加密)')),
                ('private_key_enc', models.TextField(blank=True, default='', verbose_name='应用私钥(加密)')),
                ('public_key_enc', models.TextField(blank=True, default='', verbose_name='平台公钥(加密或明文)')),
                ('cert_serial_no', models.CharField(blank=True, default='', max_length=64)),
                ('private_key_path', models.CharField(blank=True, default='', max_length=255)),
                ('platform_cert_dir', models.CharField(blank=True, default='', max_length=255)),
                ('notify_url', models.CharField(blank=True, default='', max_length=512, verbose_name='异步回调URL')),
                ('return_url', models.CharField(blank=True, default='', max_length=512, verbose_name='同步返回URL')),
                ('gateway_url', models.CharField(blank=True, default='', max_length=255, verbose_name='API网关')),
                ('mini_app_id', models.CharField(
                    blank=True,
                    default='',
                    help_text='付呗/微信JSAPI；空则回落 club.wx_appid',
                    max_length=32,
                    verbose_name='支付用小程序AppID',
                )),
                ('extra_json', models.JSONField(blank=True, default=dict, verbose_name='扩展配置')),
                ('remark', models.CharField(blank=True, default='', max_length=255)),
                ('CreateTime', models.DateTimeField(auto_now_add=True)),
                ('UpdateTime', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': '俱乐部支付通道',
                'db_table': 'club_payment_channel',
                'unique_together': {('club_id', 'channel', 'name')},
            },
        ),
        migrations.AddIndex(
            model_name='clubpaymentchannel',
            index=models.Index(fields=['club_id', 'channel', 'enabled'], name='idx_cpc_club_ch_en'),
        ),
        migrations.AddIndex(
            model_name='clubpaymentchannel',
            index=models.Index(fields=['club_id', 'is_default'], name='idx_cpc_club_default'),
        ),
    ]
