You can hike the entire length of the Oregon Coast, but it is not reasonably possible to plan on staying in towns with lodging and restaurants each night. The Oregon Coast Trail (OCT) offers a truly unique way to experience the spectacular views and natural areas along Oregon’s coastline, but it is not actually a single trail that leads from border to border. The trail includes about 40 percent paved roads, including some portions of Highway 101, with the remainder of the trail on the beach, hiking trails and unpaved roads. The actual hiking distance is approximately 425 miles if you do this trek as a thru-hike.
Thru-hiking the trail can involve a lot of planning. Due to many bays, estuaries and headlands, many portions of the trail can only be passed at low tide and others require following alternate (road) routes or arranging boat crossing to get past these areas. Hikes between hotels and restaurants is also a limiting requirement since most of the OCT is designed for overnights within Oregon State Parks.
Depending how far you would like to hike each day and your willingness to leave the trail and hike additionally on roads into nearby towns, you may be able to reasonably do much of the North and Central Coast as you have suggested. There are some stretches of the South Coast that would require hiking in excess of 8 hours per day between towns with lodging.
It sounds like you would be better off selecting some portions of the trail that fit your requirements for hotels and restaurants, as well as offer the kind of hiking experience you are after.