module ExcelReports
  module VideoReports
    module NatGeoLegalBinderLogs
      class ThirdPartyContractLogSheet < Worksheet
        def title
          "Third Party Contract Log"
        end

        def fill_content(sheet)
          sheet.add_row
          sheet.add_row
          sheet.add_row(["", "", "RIGHTS OBTAINED", "", "", "", ""])
          sheet.add_row(table_headers)
          sheet.add_row(["Graphics", "", "", "", "", "", ""])
          sheet.add_row(["Composer", "", "", "", "", "", ""])
          sheet.add_row(["Music Library", "", "", "", "", "", ""])
          sheet.add_row(["Narrator", "", "", "", "", "", ""])
          sheet.add_row(["Talent", "", "", "", "", "", ""])
          sheet.add_row(["Equipment and/or Vehicle Rental (only applicable if equipment/vehicle appears on camera and contract contains rights language)", "", "", "", "", "", ""])
          sheet.add_row(["Production Facility (only applicable if contract contains rights language)", "", "", "", "", "", ""])
          sheet.add_row(["Post Production Facility (only applicable if contract contains rights language)", "", "", "", "", "", ""])
          sheet.add_row(["Other Facilities (only applicable if contract contains rights language)", "", "", "", "", "", ""])
        end

        def format(sheet)
          sheet.column_widths *column_widths
          cells_to_merge.each { |cell| sheet.merge_cells cell }
        end

        def style(sheet)
          sheet.add_style "C3", Styles::BOLD, Styles::FULLY_CENTERED, Styles::BG_GRAY, Styles::THIN_BLACK_BORDER
          sheet.add_style "A4:G4", Styles::BOLD, Styles::FULLY_CENTERED, Styles::THIN_BLACK_BORDER
          sheet.add_style "A5:A13", Styles::FULLY_CENTERED, Styles::THIN_BLACK_BORDER, Styles::WRAP_TEXT
          sheet.add_style "B5:G13", Styles::FULLY_CENTERED, Styles::THIN_BLACK_BORDER
        end

        private

        def table_headers
          [
            "Brief Description of Services",
            "3rd Party Name and Contact Information",
            "Media",
            "Territory",
            "Term",
            "Program Specific Y/N",
            "Restrictions",
          ]
        end

        def column_widths
          [25, 30, 20, 20, 20, 15, 20]
        end

        def cells_to_merge
          %w(C3:G3)
        end
      end
    end
  end
end
