#------------------------------------------------------------
# Copyright (C) 2009 RoyaltyShare, Inc.   All Rights Reserved
#------------------------------------------------------------
package Support::SaleImporter::File;

use strict;
use warnings;
use Carp;
use File::Basename;
use URI::Escape;

use lib '/app/tools/sale_import/lib';

use lib '/app/tools/common/lib';
use Common::Assert;

use lib '/app/tools/support/lib';

use Common::FormObject;
use base 'Common::FormObject';

sub _init {
    my ( $self, %args ) = @_;

    $self->SUPER::_init(%args);

    if ( $args{file} && $args{file} ) {
        return $self->_initFromArgs( $args{file} );
    } else {
        return undef;
    }
}

sub _initFromArgs {
    my ( $self, $file ) = @_;

    return $self->_initProperties( { file => $file } );
}

sub _initProperties {
    my ( $self, $prop ) = @_;

    $self->{Path}        = $prop->{file};
    $self->{Filename}    = basename( $prop->{file} );
    $self->{EscapedPath} = uri_escape( $prop->{file} );

    return $self;
}

1;
