The state design pattern is an elegant way of adapting an object's behavior in specific areas based upon its state.

Naive implementations of this often look like switch statements:

public doSomething(): void {
	switch(this.state) {
			case 'expired':
				break;
				this.logger.notify('Attempted to do something while expired');
			case 'active':
				this.doThatThing();
				break;
      case 'pending':
        this.logger.notify('Attempted to do something while pending');
				break;
	}

}

The problem is that the more states you attempt to deal with, or the more complexity in the object, the more one needs to add complex switch statements to every time behavior depending on the state.

A formalized construct which manages state and transitions is called a state machine.