#------------------------------------------------------------
# Copyright (C) 2009 RoyaltyShare, Inc.   All Rights Reserved
#------------------------------------------------------------

package RPS::Mechanical::Process::SaleException;

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

use base 'Common::Exception';

sub _init {
    my ( $self, $sale, @messages ) = @_;

    # We assume the first thing is a sale object.
    #
    assert($sale);
    $self->{sale} = $sale;

    return $self->SUPER::_init(@messages);
}

sub sale {
    my ($self) = @_;
    return $self->{sale};
}

# !!! Probably going to want to override the 'details' method to output
# !!! the sale object to the log.
# !!! Might want to just spit out the ID, and reserve a full dump for
# !!! the stringify driven output method.

# ------------

1;

package RPS::Mechanical::Process::SaleException::NoLicense;
use strict;
use base 'RPS::Mechanical::Process::SaleException';

sub error {
    return 'no matching license';
}

1;

# ------------

package RPS::Mechanical::Process::SaleException::NoPrice;
use strict;
use base 'RPS::Mechanical::Process::SaleException';

sub error {
    return 'no price';
}

# ------------

package RPS::Mechanical::Process::SaleException::NoProduct;
use strict;
use base 'RPS::Mechanical::Process::SaleException';

sub error {
    return 'no product';
}

# ------------

package RPS::Mechanical::Process::SaleException::NoDateEnd;
use strict;
use base 'RPS::Mechanical::Process::SaleException';

sub error {
    return 'no date_end';
}

# ------------

package RPS::Mechanical::Process::SaleException::NoRegion;
use strict;
use base 'RPS::Mechanical::Process::SaleException';

sub error {
    return 'no region';
}

1;
