# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.

# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.

# FB:AUTOGEN

module FacebookAds
  # This class is auto-generated.

  # For any issues or feature requests related to this class, please let us know
  # on github and we'll fix in our codegen framework. We'll not be able to accept
  # pull request for this class.

  class Ad < AdObject
    BID_TYPE = [
      "ABSOLUTE_OCPM",
      "CPA",
      "CPC",
      "CPM",
      "MULTI_PREMIUM",
    ]

    CONFIGURED_STATUS = [
      "ACTIVE",
      "ARCHIVED",
      "DELETED",
      "PAUSED",
    ]

    EFFECTIVE_STATUS = [
      "ACTIVE",
      "ADSET_PAUSED",
      "ARCHIVED",
      "CAMPAIGN_PAUSED",
      "DELETED",
      "DISAPPROVED",
      "IN_PROCESS",
      "PAUSED",
      "PENDING_BILLING_INFO",
      "PENDING_REVIEW",
      "PREAPPROVED",
      "WITH_ISSUES",
    ]

    STATUS = [
      "ACTIVE",
      "ARCHIVED",
      "DELETED",
      "PAUSED",
    ]

    DATE_PRESET = [
      "data_maximum",
      "last_14d",
      "last_28d",
      "last_30d",
      "last_3d",
      "last_7d",
      "last_90d",
      "last_month",
      "last_quarter",
      "last_week_mon_sun",
      "last_week_sun_sat",
      "last_year",
      "maximum",
      "this_month",
      "this_quarter",
      "this_week_mon_today",
      "this_week_sun_today",
      "this_year",
      "today",
      "yesterday",
    ]

    EXECUTION_OPTIONS = [
      "include_recommendations",
      "synchronous_ad_review",
      "validate_only",
    ]

    OPERATOR = [
      "ALL",
      "ANY",
    ]

    STATUS_OPTION = [
      "ACTIVE",
      "INHERITED_FROM_SOURCE",
      "PAUSED",
    ]


    field :account_id, 'string'
    field :ad_active_time, 'string'
    field :ad_review_feedback, 'AdgroupReviewFeedback'
    field :ad_schedule_end_time, 'datetime'
    field :ad_schedule_start_time, 'datetime'
    field :adlabels, { list: 'AdLabel' }
    field :adset, 'AdSet'
    field :adset_id, 'string'
    field :bid_amount, 'int'
    field :bid_info, 'map<string, unsigned int>'
    field :bid_type, { enum: -> { BID_TYPE }}
    field :campaign, 'Campaign'
    field :campaign_id, 'string'
    field :configured_status, { enum: -> { CONFIGURED_STATUS }}
    field :conversion_domain, 'string'
    field :conversion_specs, { list: 'ConversionActionQuery' }
    field :created_time, 'datetime'
    field :creative, 'AdCreative'
    field :creative_asset_groups_spec, 'AdCreativeAssetGroupsSpec'
    field :demolink_hash, 'string'
    field :display_sequence, 'int'
    field :effective_status, { enum: -> { EFFECTIVE_STATUS }}
    field :engagement_audience, 'bool'
    field :failed_delivery_checks, { list: 'DeliveryCheck' }
    field :id, 'string'
    field :issues_info, { list: 'AdgroupIssuesInfo' }
    field :last_updated_by_app_id, 'string'
    field :name, 'string'
    field :placement, 'Placement'
    field :preview_shareable_link, 'string'
    field :priority, 'int'
    field :recommendations, { list: 'AdRecommendation' }
    field :source_ad, 'Ad'
    field :source_ad_id, 'string'
    field :status, { enum: -> { STATUS }}
    field :targeting, 'Targeting'
    field :tracking_and_conversion_with_defaults, 'TrackingAndConversionWithDefaults'
    field :tracking_specs, { list: 'ConversionActionQuery' }
    field :updated_time, 'datetime'
    field :adset_spec, 'AdSet'
    field :audience_id, 'string'
    field :date_format, 'string'
    field :draft_adgroup_id, 'string'
    field :execution_options, { list: { enum: -> { EXECUTION_OPTIONS }} }
    field :include_demolink_hashes, 'bool'

    has_edge :adcreatives do |edge|
      edge.get 'AdCreative'
    end

    has_edge :adlabels do |edge|
      edge.post 'Ad' do |api|
        api.has_param :adlabels, { list: 'object' }
        api.has_param :execution_options, { list: { enum: -> { Ad::EXECUTION_OPTIONS }} }
      end
    end

    has_edge :adrules_governed do |edge|
      edge.get 'AdRule' do |api|
        api.has_param :pass_evaluation, 'bool'
      end
    end

    has_edge :copies do |edge|
      edge.get 'Ad' do |api|
        api.has_param :date_preset, { enum: -> { Ad::DATE_PRESET }}
        api.has_param :effective_status, { list: 'string' }
        api.has_param :time_range, 'hash'
        api.has_param :updated_since, 'int'
      end
      edge.post 'Ad' do |api|
        api.has_param :adset_id, 'string'
        api.has_param :creative_parameters, 'AdCreative'
        api.has_param :rename_options, 'object'
        api.has_param :status_option, { enum: -> { Ad::STATUS_OPTION }}
      end
    end

    has_edge :insights do |edge|
      edge.get 'AdsInsights' do |api|
        api.has_param :action_attribution_windows, { list: { enum: -> { AdsInsights::ACTION_ATTRIBUTION_WINDOWS }} }
        api.has_param :action_breakdowns, { list: { enum: -> { AdsInsights::ACTION_BREAKDOWNS }} }
        api.has_param :action_report_time, { enum: -> { AdsInsights::ACTION_REPORT_TIME }}
        api.has_param :breakdowns, { list: { enum: -> { AdsInsights::BREAKDOWNS }} }
        api.has_param :date_preset, { enum: -> { AdsInsights::DATE_PRESET }}
        api.has_param :default_summary, 'bool'
        api.has_param :export_columns, { list: 'string' }
        api.has_param :export_format, 'string'
        api.has_param :export_name, 'string'
        api.has_param :fields, { list: 'string' }
        api.has_param :filtering, { list: 'object' }
        api.has_param :graph_cache, 'bool'
        api.has_param :level, { enum: -> { AdsInsights::LEVEL }}
        api.has_param :limit, 'int'
        api.has_param :product_id_limit, 'int'
        api.has_param :sort, { list: 'string' }
        api.has_param :summary, { list: 'string' }
        api.has_param :summary_action_breakdowns, { list: { enum: -> { AdsInsights::SUMMARY_ACTION_BREAKDOWNS }} }
        api.has_param :time_increment, 'string'
        api.has_param :time_range, 'hash'
        api.has_param :time_ranges, { list: 'hash' }
        api.has_param :use_account_attribution_setting, 'bool'
        api.has_param :use_unified_attribution_setting, 'bool'
      end
      edge.post 'AdReportRun' do |api|
        api.has_param :action_attribution_windows, { list: { enum: -> { AdsInsights::ACTION_ATTRIBUTION_WINDOWS }} }
        api.has_param :action_breakdowns, { list: { enum: -> { AdsInsights::ACTION_BREAKDOWNS }} }
        api.has_param :action_report_time, { enum: -> { AdsInsights::ACTION_REPORT_TIME }}
        api.has_param :breakdowns, { list: { enum: -> { AdsInsights::BREAKDOWNS }} }
        api.has_param :date_preset, { enum: -> { AdsInsights::DATE_PRESET }}
        api.has_param :default_summary, 'bool'
        api.has_param :export_columns, { list: 'string' }
        api.has_param :export_format, 'string'
        api.has_param :export_name, 'string'
        api.has_param :fields, { list: 'string' }
        api.has_param :filtering, { list: 'object' }
        api.has_param :graph_cache, 'bool'
        api.has_param :level, { enum: -> { AdsInsights::LEVEL }}
        api.has_param :limit, 'int'
        api.has_param :product_id_limit, 'int'
        api.has_param :sort, { list: 'string' }
        api.has_param :summary, { list: 'string' }
        api.has_param :summary_action_breakdowns, { list: { enum: -> { AdsInsights::SUMMARY_ACTION_BREAKDOWNS }} }
        api.has_param :time_increment, 'string'
        api.has_param :time_range, 'hash'
        api.has_param :time_ranges, { list: 'hash' }
        api.has_param :use_account_attribution_setting, 'bool'
        api.has_param :use_unified_attribution_setting, 'bool'
      end
    end

    has_edge :leads do |edge|
      edge.get 'Lead'
    end

    has_edge :previews do |edge|
      edge.get 'AdPreview' do |api|
        api.has_param :ad_format, { enum: -> { AdPreview::AD_FORMAT }}
        api.has_param :creative_feature, { enum: -> { AdPreview::CREATIVE_FEATURE }}
        api.has_param :dynamic_asset_label, 'string'
        api.has_param :dynamic_creative_spec, 'object'
        api.has_param :dynamic_customization, 'object'
        api.has_param :end_date, 'datetime'
        api.has_param :height, 'int'
        api.has_param :locale, 'string'
        api.has_param :place_page_id, 'int'
        api.has_param :post, 'object'
        api.has_param :product_item_ids, { list: 'string' }
        api.has_param :render_type, { enum: -> { AdPreview::RENDER_TYPE }}
        api.has_param :start_date, 'datetime'
        api.has_param :width, 'int'
      end
    end

    has_edge :targetingsentencelines do |edge|
      edge.get 'TargetingSentenceLine'
    end

  end
end
