module ExcelReports
  module VideoReports
    class ReleasableDataAdapter
      attr_reader :confirmation

      delegate :video, to: :confirmation

      def initialize(release_confirmation)
        @confirmation = release_confirmation
      end

      def description
        confirmation.description || confirmation.video.project.description
      end

      def episode_number
        video.number
      end

      def episode_title
        video.name
      end

      def name
        confirmation.releasable.name
      end

      def source_file_name
        confirmation.source_file_name
      end

      def clip_name
        confirmation.clip_name
      end

      def source_file_and_clip_names
        [source_file_name, clip_name].reject(&:blank?).join(" - ")
      end

      def timecode_in
        confirmation.timecode_in
      end

      def timecode_out
        confirmation.timecode_out
      end

      def duration
        confirmation.duration
      end

      def contact_address
        confirmation.releasable.contact_person.address.to_s
      end

      def applicable_media
        confirmation.releasable.applicable_medium_value
      end

      def territory
        confirmation.releasable.territory_value
      end

      def term
        confirmation.releasable.term_value
      end

      def restrictions
        confirmation.releasable.restriction_value
      end
    end
  end
end
