from sqlalchemy import BigInteger, Date, Float, String
from sqlalchemy.orm import Mapped, mapped_column

from app.models.base import Base, TimestampMixin, SoftDeleteMixin


class MaterialCost(Base, TimestampMixin, SoftDeleteMixin):
    __tablename__ = "material_cost"

    id: Mapped[str] = mapped_column(
        String(32), primary_key=True, comment="主键"
    )
    oauth_id: Mapped[str] = mapped_column(
        String(64), nullable=False, index=True, comment="授权表user_oauth自增id"
    )
    advertiser_id: Mapped[str | None] = mapped_column(
        String(64), nullable=True, index=True, comment="广告主id"
    )
    material_id: Mapped[str | None] = mapped_column(
        String(64), nullable=True, index=True, comment="素材id"
    )
    consume_date: Mapped[Date] = mapped_column(
        Date, nullable=False, index=True, comment="消耗日期"
    )
    stat_cost: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="消耗金额"
    )
    show_cnt: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="展示数"
    )
    cpm_platform: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="平均千次展现费用(元)"
    )
    click_cnt: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="点击数"
    )
    ctr: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="点击率"
    )
    cpc_platform: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="平均点击单价(元)"
    )
    convert_cnt: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="转化数"
    )
    conversion_cost: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="平均转化成本(元)"
    )
    conversion_rate: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="转化率"
    )
    deep_convert_cnt: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="深度转化数"
    )
    deep_convert_cost: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="深度转化成本(元)"
    )
    deep_convert_rate: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="深度转化率"
    )
    active: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="激活数"
    )
    active_cost: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="激活成本(元)"
    )
    active_rate: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="激活率"
    )
    active_register: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="注册数"
    )
    active_register_cost: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="注册成本(元)"
    )
    active_register_rate: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="注册率"
    )
    attribution_next_day_open_cnt: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="次留数"
    )
    attribution_next_day_open_cost: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="次留成本"
    )
    attribution_next_day_open_rate: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="次留率"
    )
    active_pay: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="首次付费数"
    )
    active_pay_cost: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="首次付费成本(元)"
    )
    active_pay_rate: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="首次付费率"
    )
    phone: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="点击电话按钮"
    )
    form: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="用户在门店落地页多线沟通提交表单的次数"
    )
    download_start: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="用户点击下载开始的次数"
    )
    form_submit: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="用户查看附加创意后，提交表单的次数"
    )
    button: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="用户点击按钮button的次数"
    )
    view: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="用户在关键页面的浏览次数"
    )
    message: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="用户点击短信咨询的次数"
    )
    consult: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="用户点击在线咨询按钮的次数"
    )
    consult_effective: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="用户在门店落地页多线沟通的在线咨询中有效咨询的次数"
    )
    shopping: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="用户购买商品的次数"
    )
    customer_effective: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="有效获客"
    )
    attribution_game_in_app_ltv_1day: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="当日付费金额"
    )
    attribution_game_in_app_roi_1day: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="当日付费ROI"
    )
    loan_completion: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="完件数互联网金融-贷款行业中，用户成功提交贷款额度申请的行为"
    )
    loan_completion_cost: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="完件成本(元)"
    )
    loan_completion_rate: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="完件率"
    )
    loan_credit: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="互联网金融-贷款行业中，用户提交贷款额度申请后，客户审批通过，给予用户可贷款的额度"
    )
    loan_credit_cost: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="授信成本(元)"
    )
    loan_credit_rate: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="授信率"
    )
    in_app_order_gmv: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="当您使用\"in_app_order\"事件回传订单金额时，对应的GMV金额，引流电商订单GMV"
    )
    in_app_order_roi: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="引流电商订单ROI"
    )
    in_app_pay_gmv: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="引流电商支付GMV"
    )
    in_app_pay_roi: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="引流电商支付ROI"
    )
    total_play: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="播放量播放时间大于0S的数量，在某些蜂窝网络环境下，需要您手动点击开始才会开始播放，因此有时播放数小于展示数。"
    )
    valid_play: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="有效播放数"
    )
    valid_play_cost: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="有效播放成本(元)"
    )
    valid_play_rate: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="有效播放率"
    )
    valid_play_of_mille: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="千次有效播放数"
    )
    valid_play_cost_of_mille: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="千次有效播放成本(元)"
    )
    average_play_time_per_play: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="平均单次播放时长"
    )
    play_over_rate: Mapped[float | None] = mapped_column(
        Float, nullable=True, comment="完播率"
    )
    dy_like: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="点赞数"
    )
    dy_comment: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="评论量"
    )
    dy_share: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="分享量"
    )
    report_cnt: Mapped[int | None] = mapped_column(
        BigInteger, nullable=True, comment="举报数"
    )