module OA
  class EditVendContractPage < OA::BasePage
    class << self
      attr_accessor :filled_in_fields
    end

    page_url "cont_mgmt/edit_vend_contract.php"

    div(:confirmation_message, class: "alertConfirm")
    button(:submit_button, value: "Submit")
    # mandatory fields
    select_list(:orchard_closer, name: "orchrep_name")
    checkbox(:digital_distribution_type, name: "dig_distribution_type[0]")
    text_field(:effective_date, name: "cont_start")
    text_field(:initial_expiration_date, name: "cont_end")
    select_list(:marketing_restriction, name: "marketing_restrictions")
    text_field(:labels_split_digital, name: "txtDigitalSplit")
    text_field(:encoding_fee_cap_back, name: "txtBackCatalogueFee")
    text_field(:encoding_fee_cap_release, name: "txtNewReleasesFee")
    select_list(:payout_currency, name: "currency_id")
    select_list(:payment_interval, name: "payment_interval")
    select_list(:pay_after, name: "pay_after")
    # non-mandatory fields
    select_list(:exclusivity, name: "exclusive")
    text_area(:negotiated_changes, name: "negotiated_change_comments")
    select_list(:unlimited_roll, name: "unlimited_roll")
    text_field(:rollover_length, name: "rollover_length_in_months")
    select_list(:can_terminate, name: "can_terminate")
    text_field(:notice_require, name: "notice_required_in_days")
    select_list(:extend_recouped, name: "extend_until_recouped")
    text_field(:advance_recoupable, name: "advance_recoupable_percentage")
    select_list(:rights_granted, name: "rights_granted[]")
    select_list(:track_publishing, name: "oms_type")
    select_list(:ringtone_publishing, name: "ringtone_publishing_type")
    text_field(:oms_mechanical, name: "oms_fee_percentage")
    select_list(:youtube_composition, name: "youtube_composition_clause")
    select_list(:opt_out_clause, name: "opt_out")
    select_list(:apply_fx_spread, name: "apply_fx_spread")
    select_list(:dms_carveout, name: "lstDMS[]")
    select_list(:territory, name: "lstTerritory[]")
    select_list(:continent, name: "lstContinents[]")
    text_field(:sync_admin_split, name: "sync_admin_commission")
    select_list(:syc_admin_type, name: "sync_admin_type_of_deal")
    text_field(:royalty_collection_split, name: "royalty_collection_commission")
    text_field(:sx_royalty_split, name: "sx_royalty_collection_commission")
    text_field(:brand_split, name: "brand_split")
    select_list(:sync_admin_territory, name: "sync_admin_territory[]")
    select_list(:royalty_collection_territory, name: "royalty_collection_territory[]")
    # Below new 3 compilation fields enabled via feature flag 'vendor_contract_compilation'
    select_list(:orchard_compilation_agreement, name: "orchard_compilation_agreement")
    text_field(:orchard_compilation_split, name: "orchard_compilation_split")
    select_list(:orchard_compilation_authorization, name: "orchard_compilation_authorization_required")
  end
end
